Add limit to video sizes

This commit is contained in:
Chocobozzz 2018-02-22 16:54:08 +01:00
parent a9ca764e7e
commit 81c263c86f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 1 deletions

View File

@ -133,9 +133,15 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy
}
uploadFirstStep () {
const videofile = this.videofileInput.nativeElement.files[0]
const videofile = this.videofileInput.nativeElement.files[0] as File
if (!videofile) return
// Cannot upload videos > 4GB for now
if (videofile.size > 4 * 1024 * 1024 * 1024) {
this.notificationsService.error('Error', 'We are sorry but PeerTube cannot handle videos > 4GB')
return
}
const videoQuota = this.authService.getUser().videoQuota
if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) {
const bytePipes = new BytesPipe()