aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/videos/video-playlists.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts
index 2e9c8aa33..5823795be 100644
--- a/server/middlewares/validators/videos/video-playlists.ts
+++ b/server/middlewares/validators/videos/video-playlists.ts
@@ -207,8 +207,8 @@ const videoPlaylistsAddVideoValidator = [
207const videoPlaylistsUpdateOrRemoveVideoValidator = [ 207const videoPlaylistsUpdateOrRemoveVideoValidator = [
208 param('playlistId') 208 param('playlistId')
209 .custom(isIdOrUUIDValid).withMessage('Should have a valid playlist id/uuid'), 209 .custom(isIdOrUUIDValid).withMessage('Should have a valid playlist id/uuid'),
210 param('videoId') 210 param('playlistElementId')
211 .custom(isIdOrUUIDValid).withMessage('Should have an video id/uuid'), 211 .custom(isIdValid).withMessage('Should have an element id/uuid'),
212 body('startTimestamp') 212 body('startTimestamp')
213 .optional() 213 .optional()
214 .custom(isVideoPlaylistTimestampValid).withMessage('Should have a valid start timestamp'), 214 .custom(isVideoPlaylistTimestampValid).withMessage('Should have a valid start timestamp'),
@@ -222,12 +222,10 @@ const videoPlaylistsUpdateOrRemoveVideoValidator = [
222 if (areValidationErrors(req, res)) return 222 if (areValidationErrors(req, res)) return
223 223
224 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return 224 if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
225 if (!await doesVideoExist(req.params.videoId, res, 'id')) return
226 225
227 const videoPlaylist = res.locals.videoPlaylist 226 const videoPlaylist = res.locals.videoPlaylist
228 const video = res.locals.video
229 227
230 const videoPlaylistElement = await VideoPlaylistElementModel.loadByPlaylistAndVideo(videoPlaylist.id, video.id) 228 const videoPlaylistElement = await VideoPlaylistElementModel.loadById(req.params.playlistElementId)
231 if (!videoPlaylistElement) { 229 if (!videoPlaylistElement) {
232 res.status(404) 230 res.status(404)
233 .json({ error: 'Video playlist element not found' }) 231 .json({ error: 'Video playlist element not found' })