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/youtube-dl.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/youtube-dl.ts')
-rw-r--r-- | server/helpers/youtube-dl.ts | 21 |
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 @@ | |||
1 | import { truncate } from 'lodash' | ||
2 | import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES } from '../initializers/constants' | 1 | import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES } from '../initializers/constants' |
3 | import { logger } from './logger' | 2 | import { logger } from './logger' |
4 | import { generateVideoImportTmpPath } from './utils' | 3 | import { generateVideoImportTmpPath } from './utils' |
5 | import { join } from 'path' | 4 | import { join } from 'path' |
6 | import { root } from './core-utils' | 5 | import { peertubeTruncate, root } from './core-utils' |
7 | import { ensureDir, writeFile, remove } from 'fs-extra' | 6 | import { ensureDir, remove, writeFile } from 'fs-extra' |
8 | import * as request from 'request' | 7 | import * as request from 'request' |
9 | import { createWriteStream } from 'fs' | 8 | import { createWriteStream } from 'fs' |
10 | 9 | ||
@@ -212,20 +211,20 @@ function buildVideoInfo (obj: any) { | |||
212 | } | 211 | } |
213 | 212 | ||
214 | function titleTruncation (title: string) { | 213 | function 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 | ||
222 | function descriptionTruncation (description: string) { | 221 | function 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 | ||