]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/commitdiff
URI decode all paths
authorJohannes <johannes@cloudron.io>
Sun, 6 Nov 2016 14:06:31 +0000 (15:06 +0100)
committerJohannes <johannes@cloudron.io>
Sun, 6 Nov 2016 14:06:31 +0000 (15:06 +0100)
src/files.js

index 6c67539c7b61445c14289498660013bd50eb15ac..747acf7cf1cf5b586af88e32ed3741094ae00577 100644 (file)
@@ -77,7 +77,7 @@ function removeBasePath(filePath) {
 }
 
 function get(req, res, next) {
-    var filePath = req.params[0];
+    var filePath = decodeURIComponent(req.params[0]);
     var absoluteFilePath = getAbsolutePath(filePath);
     if (!absoluteFilePath) return next(new HttpError(403, 'Path not allowed'));
 
@@ -145,7 +145,7 @@ function put(req, res, next) {
 }
 
 function del(req, res, next) {
-    var filePath = req.params[0];
+    var filePath = decodeURIComponent(req.params[0]);
     var recursive = !!req.query.recursive;
     var dryRun = !!req.query.dryRun;