]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blobdiff - src/files.js
Fix handling of paths with spaces
[perso/Immae/Projets/Nodejs/Surfer.git] / src / files.js
index 99b3aa25892189ea18a4d3fe40668dbc6f1718eb..6c67539c7b61445c14289498660013bd50eb15ac 100644 (file)
@@ -112,7 +112,7 @@ function get(req, res, next) {
 }
 
 function put(req, res, next) {
-    var filePath = req.params[0];
+    var filePath = decodeURIComponent(req.params[0]);
 
     if (!(req.files && req.files.file) && !req.query.directory) return next(new HttpError(400, 'missing file or directory'));
     if ((req.files && req.files.file) && req.query.directory) return next(new HttpError(400, 'either file or directory'));