Skip to content

Commit

Permalink
Supporting Non-ASCII character in file names
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-portmen committed Mar 16, 2017
1 parent 0dac91d commit 2b69e4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions host.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var https = lazyRequire('./follow-redirects').https;
var server, files = [];

var config = {
version: '0.3.0'
version: '0.3.1'
};
// closing node when parent process is killed
process.stdin.resume();
Expand Down Expand Up @@ -104,6 +104,9 @@ function observe (msg, push, done) {
}
if (req.method === 'PUT') {
let filename = req.headers['file-path'];
if (filename.startsWith('enc:')) {
filename = decodeURIComponent(filename.substr(4));
}
files.push(filename);
let file = fs.createWriteStream(filename);
req.pipe(file);
Expand All @@ -114,7 +117,6 @@ function observe (msg, push, done) {
});
});
file.on('error', (e) => {
console.error(e);
res.statusCode = 400;
res.end('HTTP/1.1 400 Bad Request');
});
Expand Down

0 comments on commit 2b69e4d

Please sign in to comment.