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/activitypub/actor.ts | |
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/activitypub/actor.ts')
-rw-r--r-- | server/helpers/custom-validators/activitypub/actor.ts | 4 |
1 files changed, 2 insertions, 2 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 |