Board copy moves the attachments to the "copied from board storage"

This commit is contained in:
Martin Filser 2022-04-30 20:07:03 +02:00
parent fbb0ed5ec1
commit 000e27a4a1
2 changed files with 3 additions and 1 deletions

View file

@ -34,12 +34,13 @@ Attachments = new FilesCollection({
return ret;
},
onAfterUpload(fileObj) {
let storage = fileObj.meta.copyStorage || STORAGE_NAME_GRIDFS;
// current storage is the filesystem, update object and database
Object.keys(fileObj.versions).forEach(versionName => {
fileObj.versions[versionName].storage = STORAGE_NAME_FILESYSTEM;
});
Attachments.update({ _id: fileObj._id }, { $set: { "versions" : fileObj.versions } });
moveToStorage(fileObj, STORAGE_NAME_GRIDFS, fileStoreStrategyFactory);
moveToStorage(fileObj, storage, fileStoreStrategyFactory);
},
interceptDownload(http, fileObj, versionName) {
const ret = fileStoreStrategyFactory.getFileStrategy(fileObj, versionName).interceptDownload(http, this.cacheControl);