X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Ffiles.js;h=d12782d8c001f5fceefe1b151b1214ce3f13dd94;hb=7bb99aff6337ee30a74a71f587c9a58eb5d24cb3;hp=3b28d3ff31d6e3fd6378338001df8c9bd34f9dd9;hpb=b9ad5d9155a65125f83071b409b4193ee97ce9d8;p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git 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) { } function getAbsolutePath(filePath) { - var absoluteFilePath = path.resolve(gBasePath, filePath); + var absoluteFilePath = path.resolve(path.join(gBasePath, filePath)); if (absoluteFilePath.indexOf(gBasePath) !== 0) return null; return absoluteFilePath; @@ -71,7 +71,7 @@ function get(req, res, next) { debug('get', absoluteFilePath); if (result.isFile()) return res.sendFile(absoluteFilePath); - if (result.isDirectory()) return res.status(200).send({ entries: fs.readdirSync(absoluteFilePath) }); + if (result.isDirectory()) return res.status(222).send({ entries: fs.readdirSync(absoluteFilePath) }); return next(new HttpError(500, 'unsupported type')); });