aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-31 15:57:32 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-08-01 09:11:04 +0200
commitbfbd912886eba17b4aa9a40dcef2fddc685d85bf (patch)
tree85e0f22980210a8ccd0888eb5e1790b152074677 /server/middlewares
parent85394ba22a07bde1dfccebf3f591a5d6dbe9df56 (diff)
downloadPeerTube-bfbd912886eba17b4aa9a40dcef2fddc685d85bf.tar.gz
PeerTube-bfbd912886eba17b4aa9a40dcef2fddc685d85bf.tar.zst
PeerTube-bfbd912886eba17b4aa9a40dcef2fddc685d85bf.zip
Fix broken playlist api
Diffstat (limited to 'server/middlewares')
-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' })