ActivityPub-federated video streaming platform using P2P directly in your web browser
Current time cannot be null
Chocobozzz640bc1a0cdc0
diff --git a/packages/tests/src/api/check-params/views.ts b/packages/tests/src/api/check-params/views.tsindex 2d3159eab0..69f8ffc6e2 100644--- a/packages/tests/src/api/check-params/views.ts+++ b/packages/tests/src/api/check-params/views.ts@@ -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 })})diff --git a/server/core/middlewares/validators/videos/video-view.ts b/server/core/middlewares/validators/videos/video-view.tsindex 14ee1da46c..3ccb9ba1fd 100644--- a/server/core/middlewares/validators/videos/video-view.ts+++ b/server/core/middlewares/validators/videos/video-view.ts@@ -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