Skip to content

Commit 94c4c1b

Browse files
committed
workaround for <Exception in template helper: idStringify> issue after core upgrade
1 parent 328cd91 commit 94c4c1b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/client/fileUpload.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ Template.afFileUpload.helpers({
5151
var collection = Mongo.Collection.get
5252
? Mongo.Collection.get(collectionName).filesCollection
5353
: global[collectionName];
54-
return collection.findOne({
55-
_id: Template.instance().fileId.get() || this.value
56-
});
54+
if (!collectionName || !collection) return null;
55+
56+
var _id = Template.instance().fileId.get() || this.value;
57+
if (typeof _id !== 'string' || _id.length === 0) return null;
58+
return collection.findOne({_id:_id});
5759
}
5860
});
5961

0 commit comments

Comments
 (0)