We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 328cd91 commit 94c4c1bCopy full SHA for 94c4c1b
lib/client/fileUpload.js
@@ -51,9 +51,11 @@ Template.afFileUpload.helpers({
51
var collection = Mongo.Collection.get
52
? Mongo.Collection.get(collectionName).filesCollection
53
: global[collectionName];
54
- return collection.findOne({
55
- _id: Template.instance().fileId.get() || this.value
56
- });
+ if (!collectionName || !collection) return null;
+
+ var _id = Template.instance().fileId.get() || this.value;
57
+ if (typeof _id !== 'string' || _id.length === 0) return null;
58
+ return collection.findOne({_id:_id});
59
}
60
});
61
0 commit comments