Added a custom key function in server side#7
Open
bensu wants to merge 1 commit intomartinklepsch:masterfrom
Open
Added a custom key function in server side#7bensu wants to merge 1 commit intomartinklepsch:masterfrom
bensu wants to merge 1 commit intomartinklepsch:masterfrom
Conversation
Owner
|
@bensu Two small things:
|
Contributor
Author
|
@martinklepsch sure!
|
Owner
|
@bensu Do I understand correctly that you'll need to provide your own In any case adding a usage example would be nice I think. Sorry for the delayed reply :) |
|
Hey @martinklepsch & @bensu , I took some time and worked to get this patch up to date with master. I also removed the s3-sign route and updated the readme with an example of using a custom key. Let me know what you think, please at #16 . Cheers! |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a conflict free version of #6 . For convenience:
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.