Return 400 if filter query is still there
This commit is contained in:
parent
d3849e9b22
commit
a0606360a7
|
@ -59,6 +59,7 @@ describe('Test video filters validators', function () {
|
||||||
expectedStatus: HttpStatusCodeType
|
expectedStatus: HttpStatusCodeType
|
||||||
excludeAlreadyWatched?: boolean
|
excludeAlreadyWatched?: boolean
|
||||||
unauthenticatedUser?: boolean
|
unauthenticatedUser?: boolean
|
||||||
|
filter?: string
|
||||||
}) {
|
}) {
|
||||||
const paths = [
|
const paths = [
|
||||||
'/api/v1/video-channels/root_channel/videos',
|
'/api/v1/video-channels/root_channel/videos',
|
||||||
|
@ -80,13 +81,18 @@ describe('Test video filters validators', function () {
|
||||||
isLocal: options.isLocal,
|
isLocal: options.isLocal,
|
||||||
privacyOneOf: options.privacyOneOf,
|
privacyOneOf: options.privacyOneOf,
|
||||||
include: options.include,
|
include: options.include,
|
||||||
excludeAlreadyWatched: options.excludeAlreadyWatched
|
excludeAlreadyWatched: options.excludeAlreadyWatched,
|
||||||
|
filter: options.filter
|
||||||
},
|
},
|
||||||
expectedStatus: options.expectedStatus
|
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 () {
|
it('Should fail with a bad privacyOneOf', async function () {
|
||||||
await testEndpoints({ privacyOneOf: [ 'toto' ] as any, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
await testEndpoints({ privacyOneOf: [ 'toto' ] as any, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||||
})
|
})
|
||||||
|
|
|
@ -515,6 +515,15 @@ const commonVideosFiltersValidator = [
|
||||||
})
|
})
|
||||||
return false
|
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()
|
return next()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue