Closed xet7 closed 2 years ago
Hmm, I read a little from docs and tried just commenting out that custom namingFunction in WeKan code. Uploading seems to work now.
@mfilser could comment, did I do anything stupid here.
It seems that after that change existing files do not work, because filename does not include text original
.
Hello @xet7,
namingFunction
Hello @xet7
I've seen https://github.com/veliovgroup/Meteor-Files/issues/847 And I'd like to jump in order to help resolving this one. Could you explain initial purpose of customnamingFunction()
hook? Since you have commented it out — it works without it in the expected way?
Commenting out only works for new attachments. Problem is, that this code, that tries to generate filename without extension, does not get filename from opts.meta.name
anymore at all, replace function does not work to remove extension:
const filenameWithoutExtension = opts.meta.name.replace(/(.+)\..+/, "$1");
I did try:
With this code, it tries to generate new filename with fileid-original-filenameWithoutExtension:
const ret = opts.meta.fileId + "-original-" + filenameWithoutExtension;
Problem is, when all that namingFunction()
code is commented out, all old existing attachments have wrong URL, and are not visible at WeKan kanban board at all.
@xet7
namingFunction
may affect files uploaded before lib update. It runs only in writing/uploading methodsconsole.log(opts)
inside namingFunction
@dr-dimitru
Error message of namingFunction
is at top first of this issue. That error has come after upgrading Meteor-Files from 2.0.1 to 2.2.1.
Hmm, just a moment, I'll try adding console.log(opts)
From the constructor docs
Function which returns
String
. Use it to create nested directories in the storage folder. Note: file extension appended to returned value
meaning it will force to append and handle file's extension on its own. And you want uploaded files have no extension?
Hi, after upgrade, uploading files does not work:
I'm getting this error:
How this namingFunction should be changed?
https://github.com/wekan/wekan/blob/master/models/attachments.js#L44
WeKan Open Source kanban https://wekan.github.io currently uses Meteor 2.7.3, Node 14.20.0 and MongoDB 5.x. WeKan has features to move attachments from MongoDB to filesystem and back.