Skip to content

Commit a9429ef

Browse files
authored
Merge pull request #44 from jankapunkt/master
Prevent TypeError on mispelled collections
2 parents a7fae8a + d890cdb commit a9429ef

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/client/fileUpload.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ Template.afFileUpload.onCreated(function () {
2222
};
2323
}
2424

25-
this.collection = Mongo.Collection.get
26-
? Mongo.Collection.get(this.data.atts.collection).filesCollection
27-
: (global[this.data.atts.collection] || Meteor.connection._mongo_livedata_collections[this.data.atts.collection].filesCollection);
25+
const mongoCollection = Mongo.Collection.get
26+
? Mongo.Collection.get(this.data.atts.collection)
27+
: Meteor.connection._mongo_livedata_collections[this.data.atts.collection]
28+
29+
this.collection = mongoCollection
30+
? mongoCollection.filesCollection
31+
: global[this.data.atts.collection]
32+
2833
this.uploadTemplate = this.data.atts.uploadTemplate || null;
2934
this.previewTemplate = this.data.atts.previewTemplate || null;
3035
this.insertConfig = Object.assign({}, this.data.atts.insertConfig || {});

package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package.describe({
22
name: 'ostrio:autoform-files',
33
summary: 'File upload for AutoForm using ostrio:files',
44
description: 'File upload for AutoForm using ostrio:files',
5-
version: '2.1.1',
5+
version: '2.1.2',
66
git: 'https://github.com/VeliovGroup/meteor-autoform-file.git'
77
});
88

0 commit comments

Comments
 (0)