Skip to content

Commit

Permalink
log when tus uploaded size differs (#5647)
Browse files Browse the repository at this point in the history
  • Loading branch information
mifi authored Feb 17, 2025
1 parent 834b013 commit ead58be
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/@uppy/companion/src/server/Uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,7 @@ class Uploader {
// https://github.com/tus/tus-js-client/blob/4479b78032937ac14da9b0542e489ac6fe7e0bc7/lib/node/fileReader.js#L50
const chunkSize = this.options.chunkSize || (isFileStream ? Infinity : 50e6)

return new Promise((resolve, reject) => {

const tusRet = await new Promise((resolve, reject) => {
const tusOptions = {
endpoint: this.options.endpoint,
uploadUrl: this.options.uploadUrl,
Expand Down Expand Up @@ -565,6 +564,14 @@ class Uploader {

this.tus.start()
})

// @ts-ignore
if (this.size != null && this.tus._size !== this.size) {
// @ts-ignore
logger.warn(`Tus uploaded size ${this.tus._size} different from reported URL size ${this.size}`, 'upload.tus.mismatch.error')
}

return tusRet;
}

async #uploadMultipart(stream) {
Expand Down

0 comments on commit ead58be

Please sign in to comment.