go-tus icon indicating copy to clipboard operation
go-tus copied to clipboard

'Location' expects absolute URL

Open jkoplo opened this issue 4 years ago • 0 comments

So I've been doing some testing using tusc, which is a statically compiled binary using this library. Everything worked great with it when using tusd as the server. But then I switched to my application that is built with tuscdotnet and the PATCH call started failing with an error about a missing server.

It turns out that tuscdotnet returns a relative path for location (Location: files/24e533e02ec3bc40c387f1a0e460e216) whereas the tusd implementation returns an absolute path (Location: https://tus.example.org/files/24e533e02ec3bc40c387f1a0e460e216).

According to the spec, either is acceptable, but the absolute is always shown in examples:

The Server MUST acknowledge a successful upload creation with the 201 Created status. The Server MUST set the Location header to the URL of the created resource. This URL MAY be absolute or relative.

So it seems that the location value needs to be checked and converted to an absolute path before the PATCH call. I'd attempt a PR, but I'm not familiar with golang at all.

jkoplo avatar Nov 12 '20 05:11 jkoplo