Allow PUT to overwrite existing files
This commit is contained in:
1 parent
1e6bb5f450
commit
ce955e34c1
2 files changed
+29
-10
No files matched your search
@@ -455,6 +455,12 @@ router.put("/files/:id", async (ctx, next) => {
|
||||
return void (ctx.status = 403);
|
||||
}
|
||||
|
||||
try {
|
||||
await db.deleteFile(id);
|
||||
} catch (err) {
|
||||
// File doesn't exist, ignore
|
||||
}
|
||||
|
||||
await db.putFile(id, metadata, ctx.req);
|
||||
log.metadata = metadata;
|
||||
logger.accessInfo(log);
|
||||
|
||||
Reference in new issue
Block a user