From: Chocobozzz Date: Mon, 4 Nov 2019 15:34:58 +0000 (+0100) Subject: Fix remove end slash function X-Git-Tag: v2.0.0~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bcd4cf0586ac376c272e7d7e24dbeb821aac579d;p=oweals%2Fpeertube.git Fix remove end slash function --- diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 39184f46d..3c41a6c0c 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -57,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 } @@ -330,9 +330,7 @@ function isNSFW (info: any) { } function removeEndSlashes (url: string) { - while (url.endsWith('/')) { - url.slice(0, -1) - } + return url.replace(/\/+$/, '') } async function promptPassword () {