Current time cannot be null
This commit is contained in:
parent
f0b8938a80
commit
640bc1a0cd
2 changed files with 3 additions and 2 deletions
|
@ -48,6 +48,7 @@ describe('Test videos views', function () {
|
|||
})
|
||||
|
||||
it('Should fail with an invalid current time', async function () {
|
||||
await servers[0].views.view({ id: videoId, currentTime: null, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await servers[0].views.view({ id: videoId, currentTime: -1, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await servers[0].views.view({ id: videoId, currentTime: 10, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
})
|
||||
|
|
|
@ -4,7 +4,7 @@ import { HttpStatusCode } from '@peertube/peertube-models'
|
|||
import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view.js'
|
||||
import { getCachedVideoDuration } from '@server/lib/video.js'
|
||||
import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer.js'
|
||||
import { isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js'
|
||||
import { isIdValid, toIntOrNull } from '../../../helpers/custom-validators/misc.js'
|
||||
import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'
|
||||
|
||||
const getVideoLocalViewerValidator = [
|
||||
|
@ -33,7 +33,7 @@ const videoViewValidator = [
|
|||
|
||||
body('currentTime')
|
||||
.customSanitizer(toIntOrNull)
|
||||
.custom(isIntOrNull),
|
||||
.isInt(),
|
||||
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
if (areValidationErrors(req, res)) return
|
||||
|
|
Loading…
Reference in a new issue