mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 21:47:10 -04:00
Meteor-Files 2.2.1 changed the function "namingFunction"
See also:
f872569be2
This commit is contained in:
parent
db8e707049
commit
344aeb4051
1 changed files with 18 additions and 7 deletions
|
@ -53,17 +53,28 @@ Attachments = new FilesCollection({
|
|||
debug: false, // Change to `true` for debugging
|
||||
collectionName: 'attachments',
|
||||
allowClientCode: true,
|
||||
/* Commenting out because this custom namingFunction did not work:
|
||||
https://github.com/veliovgroup/Meteor-Files/issues/847
|
||||
|
||||
namingFunction(opts) {
|
||||
const filenameWithoutExtension = opts.meta.name.replace(/(.+)\..+/, "$1");
|
||||
const ret = opts.meta.fileId + "-original-" + filenameWithoutExtension;
|
||||
let filenameWithoutExtension = ""
|
||||
let fileId = "";
|
||||
if (opts?.name) {
|
||||
// Client
|
||||
filenameWithoutExtension = opts.name.replace(/(.+)\..+/, "$1");
|
||||
fileId = opts.meta.fileId;
|
||||
delete opts.meta.fileId;
|
||||
} else if (opts?.file?.name) {
|
||||
// Server
|
||||
filenameWithoutExtension = opts.file.name.replace(new RegExp(opts.file.extensionWithDot + "$"), "")
|
||||
fileId = opts.fileId;
|
||||
}
|
||||
else {
|
||||
// should never reach here
|
||||
filenameWithoutExtension = Math.random().toString(36).slice(2);
|
||||
fileId = Math.random().toString(36).slice(2);
|
||||
}
|
||||
const ret = fileId + "-original-" + filenameWithoutExtension;
|
||||
// remove fileId from meta, it was only stored there to have this information here in the namingFunction function
|
||||
delete opts.meta.fileId;
|
||||
return ret;
|
||||
},
|
||||
*/
|
||||
storagePath() {
|
||||
const ret = fileStoreStrategyFactory.storagePath;
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue