mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
removed createOnAfterUpload file and use existing code for initial file move to GridFS
This commit is contained in:
parent
fe018225b4
commit
9ef45a75af
4 changed files with 18 additions and 53 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import fs from 'fs';
|
||||
import { createObjectId } from './grid/createObjectId';
|
||||
import { createOnAfterUpload } from './fsHooks/createOnAfterUpload';
|
||||
import { createInterceptDownload } from './fsHooks/createInterceptDownload';
|
||||
import { createOnAfterRemove } from './fsHooks/createOnAfterRemove';
|
||||
|
||||
|
|
@ -26,7 +25,16 @@ export default class FileStoreStrategyFactory {
|
|||
*/
|
||||
getFileStrategy(filesCollection, fileObj, versionName, storage) {
|
||||
if (!storage) {
|
||||
storage = fileObj.versions[versionName].storage || "gridfs";
|
||||
storage = fileObj.versions[versionName].storage;
|
||||
if (!storage) {
|
||||
if (fileObj.meta.source == "import") {
|
||||
// uploaded by import, so it's in GridFS (MongoDB)
|
||||
storage = "gridfs";
|
||||
} else {
|
||||
// newly uploaded, so it's at the filesystem
|
||||
storage = "fs";
|
||||
}
|
||||
}
|
||||
}
|
||||
let ret;
|
||||
if (["fs", "gridfs"].includes(storage)) {
|
||||
|
|
@ -111,12 +119,6 @@ export class FileStoreStrategyGridFs extends FileStoreStrategy {
|
|||
this.gridFsBucket = gridFsBucket;
|
||||
}
|
||||
|
||||
/** after successfull upload */
|
||||
onAfterUpload() {
|
||||
createOnAfterUpload(this.filesCollection, this.gridFsBucket, this.fileObj, this.versionName);
|
||||
super.onAfterUpload();
|
||||
}
|
||||
|
||||
/** download the file
|
||||
* @param http the current http request
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue