diff --git a/test/adding-files.html b/test/adding-files.html
index 7f137adc..74af8506 100644
--- a/test/adding-files.html
+++ b/test/adding-files.html
@@ -226,6 +226,18 @@
upload._addFiles([file]);
expect(upload.files.lentgh == 1);
});
+
+ it('should allow files with correct mime type', function() {
+ upload.accept = 'application/x-octet-stream';
+ upload._addFiles([file]);
+ expect(upload.files.lentgh == 1);
+ });
+
+ it('should allow wildcards', function() {
+ upload.accept = 'application/x-octet-stream';
+ upload._addFiles([file]);
+ expect(upload.files.lentgh == 1);
+ });
});
});
diff --git a/vaadin-upload.html b/vaadin-upload.html
index 44842f4d..6e32c74f 100644
--- a/vaadin-upload.html
+++ b/vaadin-upload.html
@@ -723,10 +723,9 @@
this.fire('file-reject', {file: file, error: this.i18n.error.fileIsTooBig});
return;
}
- var mimeType = file.type ? file.type.match(/^[^\/]*\//)[0] : null;
- var fileType = file.name.match(/\.[^\.]*$|$/)[0];
+ var fileExt = file.name.match(/\.[^\.]*$|$/)[0];
var re = new RegExp('^(' + this.accept.replace(/[, ]+/g, '|').replace('/*', '/.*') + ')$');
- if (this.accept && !(re.test(mimeType) || re.test(fileType))) {
+ if (this.accept && !(re.test(file.type) || re.test(fileExt))) {
this.fire('file-reject', {file: file, error: this.i18n.error.incorrectFileType});
return;
}