From 0b4660158a94afde1b6d3c86093bcaa0bab68843 Mon Sep 17 00:00:00 2001 From: Olli Vanhoja Date: Wed, 11 Jan 2017 15:52:40 +0200 Subject: [PATCH] Fix file mode passing for regular deployments (#214) Commit bbf1b30c4decce34a115e64201702f270eb003c3 broke file modes for regular deployments as file mode isn't retrieved anymore. --- lib/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 {