transfer.sh icon indicating copy to clipboard operation
transfer.sh copied to clipboard

File overwritten when multiple files with same name uploaded via POST

Open anihm136 opened this issue 4 years ago • 2 comments

When multiple files of the same name are uploaded via POST method, transfer.sh overwrites all of them with the last uploaded file. This happens because all the files uploaded in a single POST request get a single UID in the URL, and are named based on the upload name. How to replicate:

  1. Upload two files with the same name but different contents (for example, a/foo.txt and b/foo.txt in a single POST request
  2. Open the returned URLs

Expected outcome: The two uploaded files are different

Actual outcome: The uploaded files are the same, with one overwriting the other

Possible solutions:

  1. Generate a separate UID for each file in a POST request
  2. Add another unique random string to the filename so that the upload URL is different

anihm136 avatar Jan 16 '22 10:01 anihm136

thanks @anihm136

since you are already working on the POST handler do you mind implementing solution 1? :)

thanks

paolafrancesca avatar Jan 16 '22 10:01 paolafrancesca

Sure, will do. Might take some time depending on my schedule, so do let me know if anyone else wants to take it up in the meantime.

anihm136 avatar Jan 21 '22 08:01 anihm136