Fix 401 detection on import videos
authorChocobozzz <me@florianbigard.com>
Tue, 20 Feb 2018 17:18:47 +0000 (18:18 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 20 Feb 2018 17:18:47 +0000 (18:18 +0100)
server/tools/import-videos.ts

index 268101b41ab282b13ee687a9243ecec97591ae6e..d29a2c6f316f8700c4f61adc494cb1bf7cbf8428 100644 (file)
@@ -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)