Merge pull request #6705 from noreabu/fix-zipService-executable-flag-win32-golang

Fix: use normalized maps in zipService.js
This commit is contained in:
Mariusz Nowak 2019-11-13 13:58:02 +01:00 committed by GitHub
commit 438e1edb42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,10 @@ module.exports = {
output.on('open', () => {
zip.pipe(output);
// normalize both maps to avoid problems with e.g. Path Separators in different shells
const normalizedFiles = _.uniq(files.map(file => path.normalize(file)));
const normalizedFilesToChmodPlusX =
filesToChmodPlusX && _.uniq(filesToChmodPlusX.map(file => path.normalize(file)));
return BbPromise.all(normalizedFiles.map(this.getFileContentAndStat.bind(this)))
.then(contents => {
@ -95,8 +98,8 @@ module.exports = {
const name = file.filePath.slice(prefix ? `${prefix}${path.sep}`.length : 0);
let mode = file.stat.mode;
if (
filesToChmodPlusX &&
_.includes(filesToChmodPlusX, name) &&
normalizedFilesToChmodPlusX &&
_.includes(normalizedFilesToChmodPlusX, name) &&
file.stat.mode % 2 === 0
) {
mode += 1;