scireum / s3ninja

S3 ninja emulates the Amazon S3 API for developement and test purposes
MIT License
493 stars 91 forks source link

upload files with cotntent_type zip and filename without zip give a .zip #207

Closed hugocarnide closed 1 year ago

hugocarnide commented 2 years ago

The parameter content-type as application/zip and a filename without .zip seems not handled File pushed with a different name without extension Use of content_disposition do not give the filename as dl and a mix of target filename with .zip extension. The usage on a s3 bucket give the correct filename

Scenario

echo test > testfile.txt
zip testfile.test testfile.txt 
aws s3 cp --endpoint-url=http://localhost:9444 testfile.test s3://mybucket/123456789 --content-type "application/zip" --content-disposition 'attachment; filename = "testfile.test"'

Now download the file 123456789 from s3 ninja url http://localhost:9444/ui/mybucket/123456789

Observed output The downloaded file is 123456789.zip

Expected output The file expected to be testfile.test or at least 123456789

jakobvogel commented 1 year ago

Hello @hugocarnide 👋 Many thanks for reporting this. Please excuse the late reaction.

Actually, the /ui/ URL is just a User Interface for convenience. It exhibits non-standard behaviour such as the one you witnessed in this case. I agree that the behaviour may be surprising, and that we should consider changing it. However, please note that you should not rely on a certain behaviour of the UI for development, and rather use AWS-S3-like access to your data.

jakobvogel commented 1 year ago

I have created PR #220 for this. During development, I was wondering whether the reported behaviour is browser-specific – I failed to reproduce the condition as described. Still, the PR should solve it for all browsers.