Skip to content

Added a custom key function in server side#6

Closed
bensu wants to merge 1 commit intomartinklepsch:masterfrom
bensu:file-key
Closed

Added a custom key function in server side#6
bensu wants to merge 1 commit intomartinklepsch:masterfrom
bensu:file-key

Conversation

@bensu
Copy link
Copy Markdown
Contributor

@bensu bensu commented May 25, 2015

Users can now provide a :key-fn to the server handler which given file-name and mime-type will determine the key to use for the S3 file.

Caveat: if the client provides a file my-file.txt and the :key-fn generates a random number as a key (i.e. 12314345), the file location in S3 is given by 12314345, which is what was passed back in the s3-pipe uploaded channel. The file location is no longer sufficient for the client to know which file was successfully uploaded (in case of parallel uploads).

My (non-backwards-compatible) proposal is to put in the uploaded channel all information relevant to the client: both the file object that was uploaded and the response from S3 which contains the :key, :location, :bucket, and :etag.

@martinklepsch
Copy link
Copy Markdown
Owner

You're on a roll! 👍

If you have an example it'd be great if you could add it to the changelog (just use "unreleased" or something like that as heading.)

Also are there any other changes to the Readme required to be in sync with the new message format for the uploaded chan?

@bensu
Copy link
Copy Markdown
Contributor Author

bensu commented May 25, 2015

Forgot to document! While adding the changes to the README I produced a conflict. After solving it I can't push it into this branch, so I'm opening a new PR with the non-conflict changes in #7

@bensu bensu closed this May 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants