diff --git a/lib/index.js b/lib/index.js index 5908a97..2de724f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -128,18 +128,24 @@ module.exports = class Now extends EventEmitter { // Flatten the array to contain files to sync where each nested input // array has a group of files with the same sha but different path const files = await Promise.all(Array.prototype.concat.apply([], await Promise.all((Array.from(this._files)).map(async ([sha, {data, names}]) => { + const statFn = followSymlinks ? stat : lstat return await names.map(async name => { let mode + const getMode = async () => { + const st = await statFn(name) + return st.mode + } + if (this._static) { if (toRelative(name, this._path) === 'package.json') { mode = 33261 } else { - const st = await (followSymlinks ? stat(name) : lstat(name)) - mode = st.mode - + mode = await getMode() name = this.pathInsideContent(name) } + } else { + mode = await getMode() } return {