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:
parent
77d0ae7b20
commit
33ac85bf61
2 changed files with 48 additions and 8 deletions
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue