Skip to content

Commit d696940

Browse files
authored
Add path seperator
This avoid permission issues for users that cannot create files in "/", like "/tmpXXXX". It will generate "/tmp/XXX" instead.
1 parent bc903b4 commit d696940

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

myFetch.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const os = require('os');
44
var path = require('path');
55
var fs = require('fs');
6+
var { sep } = require('path');
67

78
function getFetcher(u) {
89
if(u.protocol === 'https:') return require('https');
@@ -29,7 +30,7 @@ function myFetch(fullUrl) {
2930
} else if(res.statusCode !== 200) {
3031
return reject(Error(`Bad status code ${res.statusCode}`));
3132
}
32-
const tmpd = fs.mkdtempSync(os.tmpdir());
33+
const tmpd = fs.mkdtempSync(`${os.tmpdir()}${sep}`);
3334
const tmpf = path.join(tmpd, 'icu-download.zip');
3435
let gotSoFar = 0;
3536
console.dir(tmpd);
@@ -55,4 +56,4 @@ function myFetch(fullUrl) {
5556
});
5657
}
5758

58-
module.exports = myFetch;
59+
module.exports = myFetch;

0 commit comments

Comments
 (0)