aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@nebulon.de>2015-06-27 15:41:43 +0200
committerJohannes Zellner <johannes@nebulon.de>2015-06-27 15:41:43 +0200
commita7f450d7b80feb2c7125813aee56ee6519b33228 (patch)
tree60eeb8d6ce9e0114648f46d20b50264e08abc348 /src
parentbead9e2436736ab72cb4eef3596746cb3c55e8d5 (diff)
downloadSurfer-a7f450d7b80feb2c7125813aee56ee6519b33228.tar.gz
Surfer-a7f450d7b80feb2c7125813aee56ee6519b33228.tar.zst
Surfer-a7f450d7b80feb2c7125813aee56ee6519b33228.zip
Fix delete
Diffstat (limited to 'src')
-rw-r--r--src/files.js6
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}