From 33ac85bf610d74d353ee456a286159872cdd83cc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 19 Apr 2022 14:25:33 +0200 Subject: Test digest check for resumable upload --- shared/server-commands/videos/videos-command.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'shared/server-commands/videos/videos-command.ts') diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts index 2ac426f76..1cceb58db 100644 --- a/shared/server-commands/videos/videos-command.ts +++ b/shared/server-commands/videos/videos-command.ts @@ -482,8 +482,17 @@ export class VideosCommand extends AbstractCommand { size: number contentLength?: number contentRangeBuilder?: (start: number, chunk: any) => string + digestBuilder?: (chunk: any) => string }) { - const { pathUploadId, videoFilePath, size, contentLength, contentRangeBuilder, expectedStatus = HttpStatusCode.OK_200 } = options + const { + pathUploadId, + videoFilePath, + size, + contentLength, + contentRangeBuilder, + digestBuilder, + expectedStatus = HttpStatusCode.OK_200 + } = options const path = '/api/v1/videos/upload-resumable' let start = 0 @@ -505,6 +514,10 @@ export class VideosCommand extends AbstractCommand { 'Content-Length': contentLength ? contentLength + '' : chunk.length + '' } + if (digestBuilder) { + Object.assign(headers, { digest: digestBuilder(chunk) }) + } + const res = await got<{ video: VideoCreateResult }>({ url, method: 'put', -- cgit v1.2.3