aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-08 21:16:10 +0100
committerGitHub <noreply@github.com>2020-12-08 21:16:10 +0100
commitf2eb23cd87cf32b8fe545178143b5f49e06a58da (patch)
treeaf7d59945af70e28fd85047e2c688c59a908f548 /client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
parentc977fd3ec931c059111ddb2b8d6ddbb20b6b99a1 (diff)
downloadPeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.gz
PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.zst
PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.zip
emit more specific status codes on video upload (#3423)
- reduce http status codes list to potentially useful codes - convert more codes to typed ones - factorize html generator for error responses
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts')
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts22
1 files changed, 14 insertions, 8 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
index bee3679f7..cafb030b9 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
@@ -9,6 +9,7 @@ import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/sh
9import { LoadingBarService } from '@ngx-loading-bar/core' 9import { LoadingBarService } from '@ngx-loading-bar/core'
10import { VideoPrivacy } from '@shared/models' 10import { VideoPrivacy } from '@shared/models'
11import { VideoSend } from './video-send' 11import { VideoSend } from './video-send'
12import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
12 13
13@Component({ 14@Component({
14 selector: 'my-video-upload', 15 selector: 'my-video-upload',
@@ -129,17 +130,17 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
129 cancelUpload () { 130 cancelUpload () {
130 if (this.videoUploadObservable !== null) { 131 if (this.videoUploadObservable !== null) {
131 this.videoUploadObservable.unsubscribe() 132 this.videoUploadObservable.unsubscribe()
133 }
132 134
133 this.isUploadingVideo = false 135 this.isUploadingVideo = false
134 this.videoUploadPercents = 0 136 this.videoUploadPercents = 0
135 this.videoUploadObservable = null 137 this.videoUploadObservable = null
136 138
137 this.firstStepError.emit() 139 this.firstStepError.emit()
138 this.enableRetryAfterError = false 140 this.enableRetryAfterError = false
139 this.error = '' 141 this.error = ''
140 142
141 this.notifier.info($localize`Upload cancelled`) 143 this.notifier.info($localize`Upload cancelled`)
142 }
143 } 144 }
144 145
145 uploadFirstStep (clickedOnButton = false) { 146 uploadFirstStep (clickedOnButton = false) {
@@ -229,6 +230,11 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
229 notifier: this.notifier, 230 notifier: this.notifier,
230 sticky: false 231 sticky: false
231 }) 232 })
233
234 if (err.status === HttpStatusCode.PAYLOAD_TOO_LARGE_413 ||
235 err.status === HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415) {
236 this.cancelUpload()
237 }
232 } 238 }
233 ) 239 )
234 } 240 }