From 687c6180bc5f48b9159bbb229ec5404cc205919e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Oct 2019 09:48:21 +0200 Subject: Fix federation issue with some actor descriptions --- server/helpers/custom-validators/activitypub/actor.ts | 4 ++-- server/helpers/custom-validators/activitypub/videos.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'server/helpers/custom-validators') diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts index 55bc8cc96..4e9aabf0e 100644 --- a/server/helpers/custom-validators/activitypub/actor.ts +++ b/server/helpers/custom-validators/activitypub/actor.ts @@ -1,9 +1,9 @@ import * as validator from 'validator' import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' import { exists, isArray } from '../misc' -import { truncate } from 'lodash' import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' import { isHostValid } from '../servers' +import { peertubeTruncate } from '@server/helpers/core-utils' function isActorEndpointsObjectValid (endpointObject: any) { return isActivityPubUrlValid(endpointObject.sharedInbox) @@ -88,7 +88,7 @@ function normalizeActor (actor: any) { } if (actor.summary && typeof actor.summary === 'string') { - actor.summary = truncate(actor.summary, { length: CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max }) + actor.summary = peertubeTruncate(actor.summary, { length: CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max }) if (actor.summary.length < CONSTRAINTS_FIELDS.USERS.DESCRIPTION.min) { actor.summary = null diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 3ba6b0744..02f914326 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts @@ -155,7 +155,7 @@ function setValidRemoteVideoUrls (video: any) { function setRemoteVideoTruncatedContent (video: any) { if (video.content) { - video.content = peertubeTruncate(video.content, CONSTRAINTS_FIELDS.VIDEOS.TRUNCATED_DESCRIPTION.max) + video.content = peertubeTruncate(video.content, { length: CONSTRAINTS_FIELDS.VIDEOS.TRUNCATED_DESCRIPTION.max }) } return true -- cgit v1.2.3