diff --git a/app/components/image/upload/image-uploader.ts b/app/components/image/upload/image-uploader.ts index 15ae6862eb..17e8c14c51 100644 --- a/app/components/image/upload/image-uploader.ts +++ b/app/components/image/upload/image-uploader.ts @@ -61,7 +61,8 @@ export class ImageUploader { } const files = ImageUploader.getFiles(event); - uploadResult.messages = uploadResult.messages.concat(this.checkForUnsupportedFileTypes(files)); + const message: string[]|undefined = this.checkForUnsupportedFileTypes(files); + if (message) uploadResult.messages.push(message); const imageFiles = files.filter(file => ImageUploader.supportedImageFileTypes.includes(ExtensionUtil.getExtension(file))); @@ -86,7 +87,7 @@ export class ImageUploader { } - private checkForUnsupportedFileTypes(files: Array): string[] { + private checkForUnsupportedFileTypes(files: Array): string[]|undefined { const supportedFileTypes = ImageUploader.supportedImageFileTypes.concat(ImageUploader.supportedWorldFileTypes); const result = ExtensionUtil.reportUnsupportedFileTypes(files, supportedFileTypes); @@ -97,7 +98,7 @@ export class ImageUploader { supportedFileTypes.map(extension => '.' + extension).join(', ') ]; } - return []; + return undefined; } diff --git a/app/core/util/extension-util.ts b/app/core/util/extension-util.ts index c2a8a38592..fdcb8df886 100644 --- a/app/core/util/extension-util.ts +++ b/app/core/util/extension-util.ts @@ -24,7 +24,7 @@ export class ExtensionUtil { let result: Array = [(files.length - ExtensionUtil.getUnsupportedExts(files, supportedFileTypes).length)]; if (uniqueUnsupportedExts.length > 0) { - result.push(uniqueUnsupportedExts.join(',')); + result.push(uniqueUnsupportedExts.join(', ')); } return result; }