diff options
Diffstat (limited to 'src/files.js')
-rw-r--r-- | src/files.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/files.js b/src/files.js index fd9c8fd..55e8978 100644 --- a/src/files.js +++ b/src/files.js | |||
@@ -62,7 +62,7 @@ function get(req, res, next) { | |||
62 | fs.stat(absoluteFilePath, function (error, result) { | 62 | fs.stat(absoluteFilePath, function (error, result) { |
63 | if (error) return next(new HttpError(404, error)); | 63 | if (error) return next(new HttpError(404, error)); |
64 | 64 | ||
65 | console.log('get', absoluteFilePath, result); | 65 | console.log('get', absoluteFilePath); |
66 | 66 | ||
67 | if (result.isFile()) return res.sendfile(absoluteFilePath); | 67 | if (result.isFile()) return res.sendfile(absoluteFilePath); |
68 | if (result.isDirectory()) return res.status(200).send({ entries: fs.readdirSync(absoluteFilePath) }); | 68 | if (result.isDirectory()) return res.status(200).send({ entries: fs.readdirSync(absoluteFilePath) }); |
@@ -82,7 +82,7 @@ function put(req, res, next) { | |||
82 | fs.stat(absoluteFilePath, function (error, result) { | 82 | fs.stat(absoluteFilePath, function (error, result) { |
83 | if (error && error.code !== 'ENOENT') return next(new HttpError(500, error)); | 83 | if (error && error.code !== 'ENOENT') return next(new HttpError(500, error)); |
84 | 84 | ||
85 | console.log('put', absoluteFilePath, result, req.files.file); | 85 | console.log('put', absoluteFilePath, req.files.file); |
86 | 86 | ||
87 | if (result && result.isDirectory()) return next(new HttpError(409, 'cannot put on directories')); | 87 | if (result && result.isDirectory()) return next(new HttpError(409, 'cannot put on directories')); |
88 | if (!result || result.isFile()) { | 88 | if (!result || result.isFile()) { |
@@ -106,7 +106,7 @@ function del(req, res, next) { | |||
106 | 106 | ||
107 | rimraf(absoluteFilePath, function (error) { | 107 | rimraf(absoluteFilePath, function (error) { |
108 | if (error) return next(new HttpError(500, 'Unable to remove')); | 108 | if (error) return next(new HttpError(500, 'Unable to remove')); |
109 | next(new HttpError(200, {})); | 109 | next(new HttpSuccess(200, {})); |
110 | }); | 110 | }); |
111 | }); | 111 | }); |
112 | } | 112 | } |