X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fvideo-comments.ts;h=fd03710c2c4aea8aa8584f539886007bdfb14416;hb=6104adc3e9d325e003ca1048e8ef35f6a451d0c3;hp=8ab0cdba4211de4615350eb76e9d0ba11ffe2fc4;hpb=d5b7d9110dd637a7f67ce9e430145314812a8df1;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index 8ab0cdba4..fd03710c2 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts @@ -1,5 +1,5 @@ import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object' -import { isVideoCommentObjectValid } from '../../helpers/custom-validators/activitypub/video-comments' +import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments' import { logger } from '../../helpers/logger' import { doRequest } from '../../helpers/requests' import { ACTIVITY_PUB } from '../../initializers' @@ -37,7 +37,7 @@ async function videoCommentActivityObjectToDBAttributes (video: VideoModel, acto } } -async function addVideoComments (instance: VideoModel, commentUrls: string[]) { +async function addVideoComments (commentUrls: string[], instance: VideoModel) { for (const commentUrl of commentUrls) { await addVideoComment(instance, commentUrl) } @@ -52,7 +52,7 @@ async function addVideoComment (videoInstance: VideoModel, commentUrl: string) { activityPub: true }) - if (isVideoCommentObjectValid(body) === false) { + if (sanitizeAndCheckVideoCommentObject(body) === false) { logger.debug('Remote video comment JSON is not valid.', { body }) return undefined } @@ -123,7 +123,7 @@ async function resolveThread (url: string, comments: VideoCommentModel[] = []) { activityPub: true }) - if (isVideoCommentObjectValid(body) === false) { + if (sanitizeAndCheckVideoCommentObject(body) === false) { throw new Error('Remote video comment JSON is not valid :' + JSON.stringify(body)) }