Skip to content

Commit 92fa2c0

Browse files
committed
Reliably parse filters option
1 parent 5320746 commit 92fa2c0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.temp
22
.idea
3+
*.iml
34
node_modules
4-
bower_components
5+
bower_components

src/module.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,15 @@ module
326326
* @private
327327
*/
328328
FileUploader.prototype._getFilters = function(filters) {
329+
function trim(str) {
330+
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
331+
}
329332
if (angular.isUndefined(filters)) return this.filters;
330333
if (angular.isArray(filters)) return filters;
331-
var names = filters.split(/\s*,/);
334+
var names = filters.split(',');
335+
for (var i = 0; i < names.length; i++) {
336+
names[i] = trim(names[i]);
337+
}
332338
return this.filters.filter(function(filter) {
333339
return names.indexOf(filter.name) !== -1;
334340
}, this);

0 commit comments

Comments
 (0)