diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-01-24 03:02:04 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-01-25 15:37:26 +0100 |
commit | ab398a05e9ffaacb8fc713bb2ba9717ac463b34c (patch) | |
tree | d73c6debfcc14c0dc05c681bb442e6f6fb6ce3a7 /client/src/app/+videos | |
parent | 6939cbac48e0a9823b34577836480ae3c28186be (diff) | |
download | PeerTube-ab398a05e9ffaacb8fc713bb2ba9717ac463b34c.tar.gz PeerTube-ab398a05e9ffaacb8fc713bb2ba9717ac463b34c.tar.zst PeerTube-ab398a05e9ffaacb8fc713bb2ba9717ac463b34c.zip |
redirect to login on 401, display error variants in 404 component
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index c757a5e93..b698d554f 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -404,7 +404,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
404 | this.videoCaptionService.listCaptions(videoId) | 404 | this.videoCaptionService.listCaptions(videoId) |
405 | ]) | 405 | ]) |
406 | .pipe( | 406 | .pipe( |
407 | // If 401, the video is private or blocked so redirect to 404 | 407 | // If 400, 403 or 404, the video is private or blocked so redirect to 404 |
408 | catchError(err => { | 408 | catchError(err => { |
409 | if (err.body.errorCode === ServerErrorCode.DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS && err.body.originUrl) { | 409 | if (err.body.errorCode === ServerErrorCode.DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS && err.body.originUrl) { |
410 | const search = window.location.search | 410 | const search = window.location.search |
@@ -416,9 +416,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
416 | $localize`Redirection` | 416 | $localize`Redirection` |
417 | ).then(res => { | 417 | ).then(res => { |
418 | if (res === false) { | 418 | if (res === false) { |
419 | return this.restExtractor.redirectTo404IfNotFound(err, [ | 419 | return this.restExtractor.redirectTo404IfNotFound(err, 'video', [ |
420 | HttpStatusCode.BAD_REQUEST_400, | 420 | HttpStatusCode.BAD_REQUEST_400, |
421 | HttpStatusCode.UNAUTHORIZED_401, | ||
422 | HttpStatusCode.FORBIDDEN_403, | 421 | HttpStatusCode.FORBIDDEN_403, |
423 | HttpStatusCode.NOT_FOUND_404 | 422 | HttpStatusCode.NOT_FOUND_404 |
424 | ]) | 423 | ]) |
@@ -428,9 +427,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
428 | }) | 427 | }) |
429 | } | 428 | } |
430 | 429 | ||
431 | return this.restExtractor.redirectTo404IfNotFound(err, [ | 430 | return this.restExtractor.redirectTo404IfNotFound(err, 'video', [ |
432 | HttpStatusCode.BAD_REQUEST_400, | 431 | HttpStatusCode.BAD_REQUEST_400, |
433 | HttpStatusCode.UNAUTHORIZED_401, | ||
434 | HttpStatusCode.FORBIDDEN_403, | 432 | HttpStatusCode.FORBIDDEN_403, |
435 | HttpStatusCode.NOT_FOUND_404 | 433 | HttpStatusCode.NOT_FOUND_404 |
436 | ]) | 434 | ]) |
@@ -464,10 +462,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
464 | 462 | ||
465 | this.playlistService.getVideoPlaylist(playlistId) | 463 | this.playlistService.getVideoPlaylist(playlistId) |
466 | .pipe( | 464 | .pipe( |
467 | // If 401, the video is private or blocked so redirect to 404 | 465 | // If 400 or 403, the video is private or blocked so redirect to 404 |
468 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ | 466 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, 'video', [ |
469 | HttpStatusCode.BAD_REQUEST_400, | 467 | HttpStatusCode.BAD_REQUEST_400, |
470 | HttpStatusCode.UNAUTHORIZED_401, | ||
471 | HttpStatusCode.FORBIDDEN_403, | 468 | HttpStatusCode.FORBIDDEN_403, |
472 | HttpStatusCode.NOT_FOUND_404 | 469 | HttpStatusCode.NOT_FOUND_404 |
473 | ])) | 470 | ])) |