Skip to content

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

Draft
Acconut wants to merge 12 commits into
mainfrom
s3store-custom-id
Draft

s3store: Allow customizing upload ID, object ID and bucket#1167
Acconut wants to merge 12 commits into
mainfrom
s3store-custom-id

Conversation

@Acconut
Copy link
Copy Markdown
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
Copy Markdown

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

@tgoyal63
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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.

@ryab001
Copy link
Copy Markdown

ryab001 commented Jul 14, 2025

Hi @Acconut ,
We have this branch running for a few months already in our system. Works fine.
This looks like a pretty interesting feature for users.
Does it makes sense to get TODO customizations out of scope of this PR and move ready changes to Release?

Thanks.

@Maousuki
Copy link
Copy Markdown

I’m really excited about this feature! I can’t wait to start using it!

@zhangjiaxin281
Copy link
Copy Markdown

I urgently need this improvement and am looking forward to its release.

fenos pushed a commit to fenos/tusd that referenced this pull request Mar 20, 2026
…hook

Backport of tus#1167 onto v2.9.2. Allows the PreCreate hook to set
Storage.Key and Storage.Bucket in FileInfoChanges to control where the
final uploaded file is stored, while .info and .part metadata files
remain in the configured store bucket.

Key changes:
- s3Upload now tracks uploadId, objectKey, objectBucket separately
- multipartId stored in .info file instead of upload ID
- Backwards compatible with old uploadId+multipartId format
- Updated serve_content to use new field names
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.

7 participants