X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fshared%2Fvideo-comments.ts;h=0961b3ec9d49ca7fcc88f42147eb589fc2d40f7f;hb=4638cd713dcdd007cd7f49b9a95fa62ac7823e7c;hp=8d1a162940dcb2c81ed8e2dd58e9befb24796316;hpb=5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/shared/video-comments.ts b/server/middlewares/validators/shared/video-comments.ts index 8d1a16294..0961b3ec9 100644 --- a/server/middlewares/validators/shared/video-comments.ts +++ b/server/middlewares/validators/shared/video-comments.ts @@ -1,10 +1,11 @@ import express from 'express' import { VideoCommentModel } from '@server/models/video/video-comment' import { MVideoId } from '@server/types/models' +import { forceNumber } from '@shared/core-utils' import { HttpStatusCode, ServerErrorCode } from '@shared/models' async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) { - const id = parseInt(idArg + '', 10) + const id = forceNumber(idArg) const videoComment = await VideoCommentModel.loadById(id) if (!videoComment) { @@ -33,7 +34,7 @@ async function doesVideoCommentThreadExist (idArg: number | string, video: MVide } async function doesVideoCommentExist (idArg: number | string, video: MVideoId, res: express.Response) { - const id = parseInt(idArg + '', 10) + const id = forceNumber(idArg) const videoComment = await VideoCommentModel.loadByIdAndPopulateVideoAndAccountAndReply(id) if (!videoComment) { @@ -57,7 +58,7 @@ async function doesVideoCommentExist (idArg: number | string, video: MVideoId, r } async function doesCommentIdExist (idArg: number | string, res: express.Response) { - const id = parseInt(idArg + '', 10) + const id = forceNumber(idArg) const videoComment = await VideoCommentModel.loadByIdAndPopulateVideoAndAccountAndReply(id) if (!videoComment) {