aboutsummaryrefslogtreecommitdiff
path: root/src/FileRouter.ts
diff options
context:
space:
mode:
authorjw2552018-04-23 15:52:09 +0100
committerjw2552018-04-23 15:52:09 +0100
commit77b834fc0f8a3db8e6a70824dbfc050113fef113 (patch)
treeed52ba77bd894fc4544445a11eb6c4b59323792c /src/FileRouter.ts
parentALL TESTS FIXXXXXXXED (diff)
downloadmedicine-77b834fc0f8a3db8e6a70824dbfc050113fef113.tar.gz
medicine-77b834fc0f8a3db8e6a70824dbfc050113fef113.zip

added support for chunking

Diffstat (limited to 'src/FileRouter.ts')
-rw-r--r--src/FileRouter.ts30
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'));