@uppy/tus: fix Node.js support (#6145)

Fixes #6119
This commit is contained in:
Merlijn Vos 2026-01-19 11:29:28 +01:00 committed by GitHub
parent efda84cc23
commit 54a46db340
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"@uppy/tus": patch
---
Fix Node.js support by conditionally setting a property which does not exist in Node.js instead of crashing.

View file

@ -251,7 +251,9 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
uploadOptions.onBeforeRequest = async (req) => { uploadOptions.onBeforeRequest = async (req) => {
const xhr = req.getUnderlyingObject() const xhr = req.getUnderlyingObject()
xhr.withCredentials = !!opts.withCredentials if (xhr) {
xhr.withCredentials = !!opts.withCredentials
}
let userProvidedPromise: Promise<void> | void let userProvidedPromise: Promise<void> | void
if (typeof onBeforeRequest === 'function') { if (typeof onBeforeRequest === 'function') {