]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/commitdiff
Fix handling of paths with spaces
authorJohannes <johannes@cloudron.io>
Sun, 6 Nov 2016 13:47:32 +0000 (14:47 +0100)
committerJohannes <johannes@cloudron.io>
Sun, 6 Nov 2016 13:47:32 +0000 (14:47 +0100)
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'));