ActivityPub-federated video streaming platform using P2P directly in your web browser
Return 400 if filter query is still there
Chocobozzza0606360a70f
diff --git a/packages/tests/src/api/check-params/videos-common-filters.ts b/packages/tests/src/api/check-params/videos-common-filters.tsindex dbae3010c3..3fb725ebc8 100644--- a/packages/tests/src/api/check-params/videos-common-filters.ts+++ b/packages/tests/src/api/check-params/videos-common-filters.ts@@ -59,6 +59,7 @@ describe('Test video filters validators', function () {expectedStatus: HttpStatusCodeTypeexcludeAlreadyWatched?: booleanunauthenticatedUser?: boolean+ filter?: string}) {const paths = ['/api/v1/video-channels/root_channel/videos',@@ -80,13 +81,18 @@ describe('Test video filters validators', function () {isLocal: options.isLocal,privacyOneOf: options.privacyOneOf,include: options.include,- excludeAlreadyWatched: options.excludeAlreadyWatched+ excludeAlreadyWatched: options.excludeAlreadyWatched,+ filter: options.filter},expectedStatus: options.expectedStatus})}}+ it('Should fail with the old filter query param', async function () {+ await testEndpoints({ filter: 'all-local', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })+ })+it('Should fail with a bad privacyOneOf', async function () {await testEndpoints({ privacyOneOf: [ 'toto' ] as any, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })})diff --git a/server/core/middlewares/validators/videos/videos.ts b/server/core/middlewares/validators/videos/videos.tsindex a1f6e72c8e..1ee5d8c4d1 100644--- a/server/core/middlewares/validators/videos/videos.ts+++ b/server/core/middlewares/validators/videos/videos.ts@@ -515,6 +515,15 @@ const commonVideosFiltersValidator = [})return false}++ if (req.query.filter) {+ res.fail({+ status: HttpStatusCode.BAD_REQUEST_400,+ message: '"filter" query parameter is not supported anymore by PeerTube. Please use "isLocal" and "include" instead'+ })+ return false+ }+return next()}]