tus-sender: resolveUploadUrl does not work properly when using relative path
See original GitHub issueDescribe the bug While using relative path, first connection with server succeeds, and then fails.
When using url : ‘/relative-path/files’ the client will fail due to the following error
tusSender.create: create upload failed TypeError: Failed to construct ‘URL’: Invalid URL at resolveUploadUrl (createUpload.js:12) at handleSuccessfulCreateResponse (createUpload.js:24) at createUpload.js:79
following code lines:
//absolute location, concatenate to upload URL without any other path
uploadUrl = new URL(createUrl).origin.replace(/\/$/, "") + location;
because createUrl variable is relative, and URL function throws an error.
To Reproduce It’s in my code base, maybe the same as issue #242 but with relative path instead of absolute path. That is – Use it as a destination: “/files”
Expected behavior To be able to provide relative path to the server.
Versions After release 0.13.5 on Chrome/Edge Chromium.
Code
** Doesn’t Work with relative URL **
<TusUploady
destination={{
url: '/Core/HandleTusFiles',
....
</TusUploady>
** Works with absolute URL **
<TusUploady
destination={{
url: 'https://localhost:44315/Core/HandleTusFiles',
....
</TusUploady>
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Yes, I can confirm it works fine now. Thank you for the quick fix !
0.13.6 is now out. Please check that it does solve the problem. thanks!