Add error message when trying to upload .ass subtitles
authorChocobozzz <me@florianbigard.com>
Mon, 14 Jan 2019 10:52:15 +0000 (11:52 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 14 Jan 2019 10:52:15 +0000 (11:52 +0100)
client/src/app/shared/forms/reactive-file.component.ts

index c3986838f549c1c18302d984c638546c043bf310..f60c38e8de8052a4b23d20547fc634906975b161 100644 (file)
@@ -53,6 +53,17 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor {
         return
       }
 
+      const extension = '.' + file.name.split('.').pop()
+      if (this.extensions.includes(extension) === false) {
+        const message = this.i18n(
+          'PeerTube cannot handle this kind of file. Accepted extensions are {{extensions}}.',
+          { extensions: this.allowedExtensionsMessage }
+        )
+        this.notifier.error(message)
+
+        return
+      }
+
       this.file = file
 
       this.propagateChange(this.file)