diff options
| author | jw255 | 2018-04-23 15:52:09 +0100 |
|---|---|---|
| committer | jw255 | 2018-04-23 15:52:09 +0100 |
| commit | 77b834fc0f8a3db8e6a70824dbfc050113fef113 (patch) | |
| tree | ed52ba77bd894fc4544445a11eb6c4b59323792c /src/FileRouter.ts | |
| parent | ALL TESTS FIXXXXXXXED (diff) | |
| download | medicine-77b834fc0f8a3db8e6a70824dbfc050113fef113.tar.gz medicine-77b834fc0f8a3db8e6a70824dbfc050113fef113.zip | |
added support for chunking
Diffstat (limited to 'src/FileRouter.ts')
| -rw-r--r-- | src/FileRouter.ts | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/FileRouter.ts b/src/FileRouter.ts index b4cd403..546c694 100644 --- a/src/FileRouter.ts +++ b/src/FileRouter.ts @@ -909,25 +909,17 @@ const postFilePath: Middleware = async( } } else { if (req.query.overwrite) { - if (req.query.truncate) { - await saveFile( - req.body, - res.locals.project.name, - res.locals.file.uuid, - req.query - ); - if (req.query.final) { - res.locals.file.status = 'preprocessing'; - await res.locals.file.save(); - preprocess(res.locals.file, res.locals.project); - } - } else { - logger.warn('overwriting without truncating not supported'); - return next(new RequestError( - 500, - 'not_implemented', - 'please specify truncate parameter' - )); + console.log("overwriting from offset " + (req.query.offset || 0)) + await saveFile( + req.body, + res.locals.project.name, + res.locals.file.uuid, + req.query + ); + if (req.query.final) { + res.locals.file.status = 'preprocessing'; + await res.locals.file.save(); + preprocess(res.locals.file, res.locals.project); } } else { return next(new RequestError(400, 'file_already_exists')); |
