MOBILE-3344 fileuploader: Accept more types in isInvalidMimetype
parent
4e987794c4
commit
ef98b9a19b
|
@ -298,12 +298,18 @@ export class CoreFileUploaderProvider {
|
||||||
* @return Undefined if file is valid, error message if file is invalid.
|
* @return Undefined if file is valid, error message if file is invalid.
|
||||||
*/
|
*/
|
||||||
isInvalidMimetype(mimetypes?: string[], path?: string, mimetype?: string): string {
|
isInvalidMimetype(mimetypes?: string[], path?: string, mimetype?: string): string {
|
||||||
let extension;
|
let extension: string;
|
||||||
|
|
||||||
if (mimetypes) {
|
if (mimetypes) {
|
||||||
// Verify that the mimetype of the file is supported.
|
// Verify that the mimetype of the file is supported.
|
||||||
if (mimetype) {
|
if (mimetype) {
|
||||||
extension = this.mimeUtils.getExtension(mimetype);
|
extension = this.mimeUtils.getExtension(mimetype);
|
||||||
|
|
||||||
|
if (mimetypes.indexOf(mimetype) == -1) {
|
||||||
|
// Get the "main" mimetype of the extension.
|
||||||
|
// It's possible that the list of accepted mimetypes only includes the "main" mimetypes.
|
||||||
|
mimetype = this.mimeUtils.getMimeType(extension);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
extension = this.mimeUtils.getFileExtension(path);
|
extension = this.mimeUtils.getFileExtension(path);
|
||||||
mimetype = this.mimeUtils.getMimeType(extension);
|
mimetype = this.mimeUtils.getMimeType(extension);
|
||||||
|
|
Loading…
Reference in New Issue