diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/files.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/files.js b/src/files.js index 3b28d3f..d12782d 100644 --- a/src/files.js +++ b/src/files.js | |||
@@ -54,7 +54,7 @@ function copyFile(source, target, cb) { | |||
54 | } | 54 | } |
55 | 55 | ||
56 | function getAbsolutePath(filePath) { | 56 | function getAbsolutePath(filePath) { |
57 | var absoluteFilePath = path.resolve(gBasePath, filePath); | 57 | var absoluteFilePath = path.resolve(path.join(gBasePath, filePath)); |
58 | 58 | ||
59 | if (absoluteFilePath.indexOf(gBasePath) !== 0) return null; | 59 | if (absoluteFilePath.indexOf(gBasePath) !== 0) return null; |
60 | return absoluteFilePath; | 60 | return absoluteFilePath; |
@@ -71,7 +71,7 @@ function get(req, res, next) { | |||
71 | debug('get', absoluteFilePath); | 71 | debug('get', absoluteFilePath); |
72 | 72 | ||
73 | if (result.isFile()) return res.sendFile(absoluteFilePath); | 73 | if (result.isFile()) return res.sendFile(absoluteFilePath); |
74 | if (result.isDirectory()) return res.status(200).send({ entries: fs.readdirSync(absoluteFilePath) }); | 74 | if (result.isDirectory()) return res.status(222).send({ entries: fs.readdirSync(absoluteFilePath) }); |
75 | 75 | ||
76 | return next(new HttpError(500, 'unsupported type')); | 76 | return next(new HttpError(500, 'unsupported type')); |
77 | }); | 77 | }); |