adhocore / tusc.sh

tus 1.0.0 client protocol implementation for bash. Resumable large file upload to Tus sever from terminal using bash script
https://github.com/adhocore/tusc.sh
MIT License
36 stars 9 forks source link

Tus server replied with empty location #21

Closed happysalada closed 1 year ago

happysalada commented 1 year ago

I've tried running on a tus server that works with the js upload library. However I keep on getting an error with this script DEBUG=1 ./result/bin/tusc -H https://rustus.sassy.technology -f ../../Downloads/ATDP _Bitval.pdf -b /files/ HOST : https://myhost HEADER: /var/folders/m4/1cnl1mnn6qbcnjr7pyshnfd40000gn/T/tus.kJhxpdj8xv FILE : ATDP_Bitval.pdf SIZE : 63191 KEY : 8ba20e8bd53cabb96c1ee16fac581125b22f7f12 CHKSUM: sha1 OGJhMjBlOGJkNTNjYWJiOTZjMWVlMTZmYWM1ODExMjViMjJmN2YxMg==

curl -sSLD /var/folders/m4/1cnl1mnn6qbcnjr7pyshnfd40000gn/T/tus.kJhxpdj8xv -H 'Tus-Resumable: 1.0.0' -H 'Upload-Length: 63191' -H 'Upload-Key: 8ba20e8bd53cabb96c1ee16fac581125b22f7f12' -H 'Upload-Checksum: sha1 OGJhMjBlOGJkNTNjYWJiOTZjMWVlMTZmYWM1ODExMjViMjJmN2YxMg==' -H 'Upload-Metadata: filename QVREUF9CaXR2YWwucGRm' -X POST https://myhost/files/ Tus server replied with empty location. Try changing --base-path param. ✖ Unfinished upload, please rerun the command to resume.

I'm not sure where the problem comes from.

happysalada commented 1 year ago

This is the server implementation I'm running on the other side https://github.com/s3rius/rustus

adhocore commented 1 year ago

ideally for a tus server, it must reply with Location header in response after upload has been finished (i am not sure if tus protocol has changed ever since this project was done though)

btw is the base path in your case /files instead of /files/ ? for some servers the trailing / might matter

s3rius commented 1 year ago

@adhocore, I cheked the documentation from tus.io and Location header must be returned only when new upload was created. When upload is finished, no Location is returned.

happysalada commented 1 year ago

I tested with https://github.com/cenkalti/tus.py and the upload did succeed. (just in case it helps)

adhocore commented 1 year ago

i have fixed/added a few things and released v1.1.0

and the tests with original tusd server is working fine

happysalada commented 1 year ago

Just tested with a random image and I'm getting

Wrong checksum
✖ Unfinished upload, please rerun the command to resume.

I've tested with both -b /files and -b /files/

adhocore commented 1 year ago

that is an issue of server it seems. related to Expect header error 417. you can try with DEBUG=1 for more verbose output.

adhocore commented 1 year ago

@happysalada should we check with one another server implementation?

happysalada commented 1 year ago

I unfortunately dont have another implementation at hand. Im going to assume this is due to the particular rust implementation and close this . Thanks for having taken a look at this!

adhocore commented 1 year ago

thanks. (git lfs supports tus proto just in case it might be of any interest)

and to be fair, i did try a few curl options for large file upload against rustus - all giving 417 Expect header error

adhocore commented 1 year ago

@happysalada because of a very useful improvement to this library via #26 (for ticket #25), it is advisable to bump to 1.1.1 in https://github.com/NixOS/nixpkgs/pull/261434, cheers!

happysalada commented 1 year ago

Ive opened a new PR to update, thanks !