Skip to content

Commit c914b33

Browse files
fixed bug with spaces in filenames
1 parent 6afc133 commit c914b33

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/application/filesharing/filesharing.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ var formidable = require('formidable');
66
var handleUpload = function(request, response, inform) {
77
var form = new formidable.IncomingForm();
88
form.parse(request, function(error, fields, files) {
9-
fs.rename(files.file.path, '/tmp/bivouac_upload_' + files.file.name, function(err) {
10-
inform(files.file.name, files.file.type);
9+
var filename = files.file.name.replace(/ /g, '_');
10+
fs.rename(files.file.path, '/tmp/bivouac_upload_' + filename, function(err) {
11+
inform(filename, files.file.type);
1112
response.writeHead(200, {'content-type': 'text/plain'});
1213
response.end(JSON.stringify('ok'));
1314
});

0 commit comments

Comments
 (0)