]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/videos-command.ts
Fix silent 500 after resumable upload
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / videos-command.ts
index d35339c8d4770b3e57b3041da73967df3420b7c6..63980c147d1f4f48c7964552254346c266b30193 100644 (file)
@@ -449,6 +449,8 @@ export class VideosCommand extends AbstractCommand {
 
       const result = await this.sendResumableChunks({ ...options, pathUploadId, videoFilePath, size })
 
+      await this.endResumableUpload({ ...options, pathUploadId })
+
       return result.body?.video || result.body as any
     }
 
@@ -542,6 +544,19 @@ export class VideosCommand extends AbstractCommand {
     })
   }
 
+  endResumableUpload (options: OverrideCommandOptions & {
+    pathUploadId: string
+  }) {
+    return this.deleteRequest({
+      ...options,
+
+      path: '/api/v1/videos/upload-resumable',
+      rawQuery: options.pathUploadId,
+      implicitToken: true,
+      defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
+    })
+  }
+
   quickUpload (options: OverrideCommandOptions & {
     name: string
     nsfw?: boolean