diff options
author | Chocobozzz <me@florianbigard.com> | 2019-10-21 09:48:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-10-21 09:52:51 +0200 |
commit | 687c6180bc5f48b9159bbb229ec5404cc205919e (patch) | |
tree | 31e5c628baf96238a644da7e0b6affc597019fc5 /server/helpers/custom-validators | |
parent | 4386e66e5538b6336be7cbcbe70bcb1909a1afdc (diff) | |
download | PeerTube-687c6180bc5f48b9159bbb229ec5404cc205919e.tar.gz PeerTube-687c6180bc5f48b9159bbb229ec5404cc205919e.tar.zst PeerTube-687c6180bc5f48b9159bbb229ec5404cc205919e.zip |
Fix federation issue with some actor descriptions
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/activitypub/actor.ts | 4 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 2 |
2 files changed, 3 insertions, 3 deletions
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 @@ | |||
1 | import * as validator from 'validator' | 1 | import * as validator from 'validator' |
2 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' | 2 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' |
3 | import { exists, isArray } from '../misc' | 3 | import { exists, isArray } from '../misc' |
4 | import { truncate } from 'lodash' | ||
5 | import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' | 4 | import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' |
6 | import { isHostValid } from '../servers' | 5 | import { isHostValid } from '../servers' |
6 | import { peertubeTruncate } from '@server/helpers/core-utils' | ||
7 | 7 | ||
8 | function isActorEndpointsObjectValid (endpointObject: any) { | 8 | function isActorEndpointsObjectValid (endpointObject: any) { |
9 | return isActivityPubUrlValid(endpointObject.sharedInbox) | 9 | return isActivityPubUrlValid(endpointObject.sharedInbox) |
@@ -88,7 +88,7 @@ function normalizeActor (actor: any) { | |||
88 | } | 88 | } |
89 | 89 | ||
90 | if (actor.summary && typeof actor.summary === 'string') { | 90 | if (actor.summary && typeof actor.summary === 'string') { |
91 | actor.summary = truncate(actor.summary, { length: CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max }) | 91 | actor.summary = peertubeTruncate(actor.summary, { length: CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max }) |
92 | 92 | ||
93 | if (actor.summary.length < CONSTRAINTS_FIELDS.USERS.DESCRIPTION.min) { | 93 | if (actor.summary.length < CONSTRAINTS_FIELDS.USERS.DESCRIPTION.min) { |
94 | actor.summary = null | 94 | 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) { | |||
155 | 155 | ||
156 | function setRemoteVideoTruncatedContent (video: any) { | 156 | function setRemoteVideoTruncatedContent (video: any) { |
157 | if (video.content) { | 157 | if (video.content) { |
158 | video.content = peertubeTruncate(video.content, CONSTRAINTS_FIELDS.VIDEOS.TRUNCATED_DESCRIPTION.max) | 158 | video.content = peertubeTruncate(video.content, { length: CONSTRAINTS_FIELDS.VIDEOS.TRUNCATED_DESCRIPTION.max }) |
159 | } | 159 | } |
160 | 160 | ||
161 | return true | 161 | return true |