Meteor-Files: namingFunction does not trigger
I have created a files collection like so:
const options = {
debug: true,
collectionName: 'files',
namingFunction: (a) => {
console.log('Yey, the naming function is being called');
return 'thing';
}
};
export const Files = new Meteor.Files(options);
Files.allow({
insert() {
return true;
},
update() {
return true;
},
remove() {
return true;
},
});
Later in my code, I call this function to add a file:
const addFile = (file) => {
const newFile = { name: file.name, type: file.type, meta: {} };
return Meteor.wrapAsync(Files.addFile, Files)(file.path, newFile)._id;
};
The issue is that Yey, the naming function is being called, never gets logged. The reason for adding this console log, was because I was suspecting that the naming function was not being called, since the new saved file name does not get renamed as I wish.
Also, although the collectionName works, it seems like other options do not trigger either, such as, storagePath.
Am I right in assuming that the namingFunction should run every time I call the addFile function?
Just for the record, this is a server issue, since I do not use the package in the front-end, in pro of using ‘ng-file-upload’.
Meteor version: 1.4.1.2 Meteor-Files version: Latest (I assume, my .meteor/package file reads ‘ostrio:files’, the version is not specified)
Thanks, any help will be much appreciated.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 31 (15 by maintainers)
Sure thing, well deserved stars