Skip to content

s3store: Allow customizing upload ID, object ID and bucket #1167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Acconut
Copy link
Member

@Acconut Acconut commented Aug 2, 2024

Previously, the upload ID included the multipart ID, which made fully customizing the upload ID (and thus upload URL) impossible. With this PR, we hope to allow full customization of the upload ID and even the destination object key.

Overall changes:

  • Removes the multipart ID from the upload ID and instead loads it from the info file
  • Allow customization of upload ID
  • Allow customization of destination object key via Storage.Key
  • Allow customization of destination bucket via Storage.Bucket

TODO:

  • Manual testing
  • Allow customization of S3 metadata
  • Allow customization of S3 storage class
  • Allow customization of Content-Type, Content-Encoding, Content-Language, Content-Disposition and Cache-Control

@Acconut Acconut self-assigned this Aug 2, 2024
@Acconut Acconut changed the title s3store: Allow customizing upload ID and object ID s3store: Allow customizing upload ID, object ID and bucket Sep 18, 2024
@Acconut Acconut added this to the v3 milestone Sep 18, 2024
@mosi-kha
Copy link

Hi, I'm excited when this PR will merge.
the custom bucket name is what I need

@tgoyal63
Copy link

tgoyal63 commented Feb 28, 2025

Hi @Acconut,
Really excited and waiting for so long for this to be merged.
Please let us know if there's any ETA for this.

Thanks ❤️

@mbrimmer83
Copy link

Is this work stalled? One thing that would be nice is to allow choosing the uuid version. I'd be happy to let tusd generate id's if I could set it to generate uuid v7.

@mbrimmer83
Copy link

case Image.create_image(conn, attrs) do
  {:ok, image} ->
     mime_type = Map.get(metadata, "filetype")
     ext = mime_to_ext(mime_type)

       json(conn, %{
           "ChangeFileInfo" => %{
               "ID" => "images/#{image.id}.#{ext}"
            }
       })

  {:error, msg} ->
    send_resp(conn, 500, "Failed to create image")
 end

When I do this the in the pre-create hook, file is uploaded to S3 inside the image folder with the id as name and extension. Is this functionality already available?

@Acconut
Copy link
Member Author

Acconut commented Apr 24, 2025

When I do this the in the pre-create hook, file is uploaded to S3 inside the image folder with the id as name and extension. Is this functionality already available?

Partly, yes. The s3store respected values for upload ID from the pre-create for a long time already, but it currently always appends the multipart upload ID to form the upload URL. That allows you to control the location where the file is saved on S3 right now without waiting for this PR as long as you are fine with exposing that location in the upload URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Backwards compatibility breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants