Question:This is an explanation of a problem, I encountered while uploading files to S3 using tus-node-server or Tusd.
The problem, is I have a server running tus server and takes requests from react and react native clients. The file gets uploaded successfully from the client to S3, but when I check inside S3 bucket, the content-type is always converted to application/octet-stream.
Tried setting the content-type headers but the tus server didn’t like that.
In the answer below I explain how to resolve the issue:
Best Answer:It turns out that it has to be passed as a metadata like this from tus-js-client or uppy client.
Code looks like this:
Please note that contentType is the key to setting the content-type on the tus server header. The metadata will be decoded and will be set correctly to S3 content-type.
If you have better answer, please add a comment about this, thank you!