aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/youtube-dl.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-10-21 09:48:21 +0200
committerChocobozzz <me@florianbigard.com>2019-10-21 09:52:51 +0200
commit687c6180bc5f48b9159bbb229ec5404cc205919e (patch)
tree31e5c628baf96238a644da7e0b6affc597019fc5 /server/helpers/youtube-dl.ts
parent4386e66e5538b6336be7cbcbe70bcb1909a1afdc (diff)
downloadPeerTube-687c6180bc5f48b9159bbb229ec5404cc205919e.tar.gz
PeerTube-687c6180bc5f48b9159bbb229ec5404cc205919e.tar.zst
PeerTube-687c6180bc5f48b9159bbb229ec5404cc205919e.zip
Fix federation issue with some actor descriptions
Diffstat (limited to 'server/helpers/youtube-dl.ts')
-rw-r--r--server/helpers/youtube-dl.ts21
1 files changed, 10 insertions, 11 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts
index b3079370f..87a0d0584 100644
--- a/server/helpers/youtube-dl.ts
+++ b/server/helpers/youtube-dl.ts
@@ -1,10 +1,9 @@
1import { truncate } from 'lodash'
2import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES } from '../initializers/constants' 1import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES } from '../initializers/constants'
3import { logger } from './logger' 2import { logger } from './logger'
4import { generateVideoImportTmpPath } from './utils' 3import { generateVideoImportTmpPath } from './utils'
5import { join } from 'path' 4import { join } from 'path'
6import { root } from './core-utils' 5import { peertubeTruncate, root } from './core-utils'
7import { ensureDir, writeFile, remove } from 'fs-extra' 6import { ensureDir, remove, writeFile } from 'fs-extra'
8import * as request from 'request' 7import * as request from 'request'
9import { createWriteStream } from 'fs' 8import { createWriteStream } from 'fs'
10 9
@@ -212,20 +211,20 @@ function buildVideoInfo (obj: any) {
212} 211}
213 212
214function titleTruncation (title: string) { 213function titleTruncation (title: string) {
215 return truncate(title, { 214 return peertubeTruncate(title, {
216 'length': CONSTRAINTS_FIELDS.VIDEOS.NAME.max, 215 length: CONSTRAINTS_FIELDS.VIDEOS.NAME.max,
217 'separator': /,? +/, 216 separator: /,? +/,
218 'omission': ' […]' 217 omission: ' […]'
219 }) 218 })
220} 219}
221 220
222function descriptionTruncation (description: string) { 221function descriptionTruncation (description: string) {
223 if (!description || description.length < CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.min) return undefined 222 if (!description || description.length < CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.min) return undefined
224 223
225 return truncate(description, { 224 return peertubeTruncate(description, {
226 'length': CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max, 225 length: CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max,
227 'separator': /,? +/, 226 separator: /,? +/,
228 'omission': ' […]' 227 omission: ' […]'
229 }) 228 })
230} 229}
231 230