diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-08 21:16:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 21:16:10 +0100 |
commit | f2eb23cd87cf32b8fe545178143b5f49e06a58da (patch) | |
tree | af7d59945af70e28fd85047e2c688c59a908f548 /server/lib/activitypub/videos.ts | |
parent | c977fd3ec931c059111ddb2b8d6ddbb20b6b99a1 (diff) | |
download | PeerTube-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 'server/lib/activitypub/videos.ts')
-rw-r--r-- | server/lib/activitypub/videos.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 04f0bfc23..b15d5da1c 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -76,6 +76,7 @@ import { sendCreateVideo, sendUpdateVideo } from './send' | |||
76 | import { addVideoShares, shareVideoByServerAndChannel } from './share' | 76 | import { addVideoShares, shareVideoByServerAndChannel } from './share' |
77 | import { addVideoComments } from './video-comments' | 77 | import { addVideoComments } from './video-comments' |
78 | import { createRates } from './video-rates' | 78 | import { createRates } from './video-rates' |
79 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
79 | 80 | ||
80 | async function federateVideoIfNeeded (videoArg: MVideoAPWithoutCaption, isNewVideo: boolean, transaction?: sequelize.Transaction) { | 81 | async function federateVideoIfNeeded (videoArg: MVideoAPWithoutCaption, isNewVideo: boolean, transaction?: sequelize.Transaction) { |
81 | const video = videoArg as MVideoAP | 82 | const video = videoArg as MVideoAP |
@@ -488,7 +489,7 @@ async function refreshVideoIfNeeded (options: { | |||
488 | 489 | ||
489 | try { | 490 | try { |
490 | const { response, videoObject } = await fetchRemoteVideo(video.url) | 491 | const { response, videoObject } = await fetchRemoteVideo(video.url) |
491 | if (response.statusCode === 404) { | 492 | if (response.statusCode === HttpStatusCode.NOT_FOUND_404) { |
492 | logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url) | 493 | logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url) |
493 | 494 | ||
494 | // Video does not exist anymore | 495 | // Video does not exist anymore |