From: Rigel Kent Date: Mon, 26 Mar 2018 12:07:45 +0000 (+0200) Subject: truncating long video names in import-videos.js (fixes #392) (#415) X-Git-Tag: v1.0.0-beta.2~28 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=45b8a42ca1869ef36d565c6062fa569d718c91e9;p=oweals%2Fpeertube.git truncating long video names in import-videos.js (fixes #392) (#415) --- diff --git a/server/tools/import-videos.ts b/server/tools/import-videos.ts index baaedd329..27d0732a6 100644 --- a/server/tools/import-videos.ts +++ b/server/tools/import-videos.ts @@ -6,6 +6,7 @@ import { unlinkPromise } from '../helpers/core-utils' import { doRequestAndSaveToFile } from '../helpers/requests' import { CONSTRAINTS_FIELDS } from '../initializers' import { getClient, getVideoCategories, login, searchVideo, uploadVideo } from '../tests/utils' +import { truncate } from 'lodash' program .option('-u, --url ', 'Server url') @@ -133,7 +134,11 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, languag } const videoAttributes = { - name: videoInfo.title, + name: truncate(videoInfo.title, { + 'length': CONSTRAINTS_FIELDS.VIDEOS.NAME.max, + 'separator': /,? +/, + 'omission': ' […]' + }), category, licence, language,