1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 17:59:37 +02:00

Test digest check for resumable upload

This commit is contained in:
Chocobozzz 2022-04-19 14:25:33 +02:00
parent 77d0ae7b20
commit 33ac85bf61
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 48 additions and 8 deletions

View file

@ -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',