mirror of https://github.com/Chocobozzz/PeerTube
Return 400 if filter query is still there
parent
d3849e9b22
commit
a0606360a7
|
@ -59,6 +59,7 @@ describe('Test video filters validators', function () {
|
|||
expectedStatus: HttpStatusCodeType
|
||||
excludeAlreadyWatched?: boolean
|
||||
unauthenticatedUser?: 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 })
|
||||
})
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue