import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
import { Notifier } from '@app/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
+import { GlobalIconName } from '@app/shared/images/global-icon.component'
@Component({
selector: 'my-reactive-file',
@Input() extensions: string[] = []
@Input() maxFileSize: number
@Input() displayFilename = false
+ @Input() icon: GlobalIconName
@Output() fileChanged = new EventEmitter<Blob>()
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)