X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fpeertube-import-videos.ts;h=b3c3aee3e496a975bf8a4ad6c2e26df7022ebf73;hb=49c3bf6fa25afb49c8a27937147043c6e4ce95c3;hp=fcb90cca3f30af56493c1cc211d47eca62d23b7a;hpb=282e61e6c11f79e919c543871783fe1a00298d18;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index fcb90cca3..b3c3aee3e 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -1,3 +1,6 @@ +import { registerTSPaths } from '../helpers/register-ts-paths' +registerTSPaths() + // FIXME: https://github.com/nodejs/node/pull/16853 require('tls').DEFAULT_ECDH_CURVE = 'auto' @@ -54,8 +57,8 @@ getServerCredentials(command) exitError('--tmpdir %s: directory does not exist or is not accessible', program[ 'tmpdir' ]) } - removeEndSlashes(url) - removeEndSlashes(program[ 'targetUrl' ]) + url = removeEndSlashes(url) + program[ 'targetUrl' ] = removeEndSlashes(program[ 'targetUrl' ]) const user = { username, password } @@ -327,9 +330,7 @@ function isNSFW (info: any) { } function removeEndSlashes (url: string) { - while (url.endsWith('/')) { - url.slice(0, -1) - } + return url.replace(/\/+$/, '') } async function promptPassword () { @@ -372,6 +373,7 @@ function parseDate (dateAsStr: string): Date { exitError(`Invalid date passed: ${dateAsStr}. Expected format: YYYY-MM-DD. See help for usage.`); } const date = new Date(dateAsStr); + date.setHours(0, 0, 0); if (isNaN(date.getTime())) { exitError(`Invalid date passed: ${dateAsStr}. See help for usage.`); }