mirror of
https://github.com/wekan/wekan.git
synced 2025-12-31 14:48:48 +01:00
parent
21c09c67e4
commit
26e1c1dc4a
5 changed files with 71 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ import { createBucket } from './lib/grid/createBucket';
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { AttachmentStoreStrategyFilesystem, AttachmentStoreStrategyGridFs} from '/models/lib/attachmentStoreStrategy';
|
||||
import FileStoreStrategyFactory, {moveToStorage, STORAGE_NAME_FILESYSTEM, STORAGE_NAME_GRIDFS} from '/models/lib/fileStoreStrategy';
|
||||
import FileStoreStrategyFactory, {moveToStorage, rename, STORAGE_NAME_FILESYSTEM, STORAGE_NAME_GRIDFS} from '/models/lib/fileStoreStrategy';
|
||||
|
||||
let attachmentBucket;
|
||||
let storagePath;
|
||||
|
|
@ -87,6 +87,13 @@ if (Meteor.isServer) {
|
|||
const fileObj = Attachments.findOne({_id: fileObjId});
|
||||
moveToStorage(fileObj, storageDestination, fileStoreStrategyFactory);
|
||||
},
|
||||
renameAttachment(fileObjId, newName) {
|
||||
check(fileObjId, String);
|
||||
check(newName, String);
|
||||
|
||||
const fileObj = Attachments.findOne({_id: fileObjId});
|
||||
rename(fileObj, newName, fileStoreStrategyFactory);
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.startup(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue