Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix 401 detection on import videos

Chocobozzzb6fe1f985c34
diff --git a/server/tools/import-videos.ts b/server/tools/import-videos.ts
index 268101b41a..d29a2c6f31 100644
--- a/server/tools/import-videos.ts
+++ b/server/tools/import-videos.ts
@@ -148,7 +148,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, languag
try {
await uploadVideo(program['url'], accessToken, videoAttributes)
} catch (err) {
- if (err.message.indexOf('401')) {
+ if (err.message.indexOf('401') !== -1) {
console.log('Got 401 Unauthorized, token may have expired, renewing token and retry.')
const res = await login(program['url'], client, user)