aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/activitypub/actor.ts4
-rw-r--r--server/helpers/custom-validators/activitypub/videos.ts2
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 @@
1import * as validator from 'validator' 1import * as validator from 'validator'
2import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' 2import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
3import { exists, isArray } from '../misc' 3import { exists, isArray } from '../misc'
4import { truncate } from 'lodash'
5import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' 4import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc'
6import { isHostValid } from '../servers' 5import { isHostValid } from '../servers'
6import { peertubeTruncate } from '@server/helpers/core-utils'
7 7
8function isActorEndpointsObjectValid (endpointObject: any) { 8function 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
156function setRemoteVideoTruncatedContent (video: any) { 156function 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