jaredramirez / elm-s3

Uploading files to S3 quick and easy
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Uploading without an explicit prefix creates an “invisible” top-level folder #2

Closed zoul closed 4 years ago

zoul commented 5 years ago

When I don’t set an explicit prefix using S3.withPrefix (or start the prefix with a slash), a “invisible” no-name top-level folder is created in the bucket. I think the problem is in the uploadFileTask function, assembling the key:

 key =
    interpolate "{0}/{1}"
        [ record.prefix
        , fileData.fileName
        ]

This makes total sense – except it seems that somewhere along the way another slash gets prepended to the key. This means that with an empty prefix, the key gets set to "/filename" and later to "//filename", which S3 happily inflates into a no-name folder as can be seen in the S3 Management Console. (Same thing happens if there is a prefix, but starts with a slash.)

jaredramirez commented 4 years ago

Thanks for this! Sorry for taking so long to for me to address this. This should be fixed in 1.0.4.