-
Notifications
You must be signed in to change notification settings - Fork 149
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
key should be Key, capitalized, following the AWS SDK documentation #745
Comments
Could you provide a more detailed example resembling your internal tests? I'm not too familiar with how |
Of course! The idea of Then you can create a link (server) with parameters for submission and add it to a form (client). So let's say you add the filename that will be inside s3, control the expiry time and set the upload condition, something like:
To use in form: // URL_VALUE url to upload
// VALUE params to use on upload
<form action="URL_VALUE" method="post" enctype="multipart/form-data">
<input type="hidden" name="key" value="VALUE" />
<input type="hidden" name="AWSAccessKeyId" value="VALUE" />
<input type="hidden" name="policy" value="VALUE" />
<input type="hidden" name="signature" value="VALUE" />
File:
<input type="file" name="file" /> <br />
<input type="submit" name="submit" value="Upload to Amazon S3" />
</form>
In order for the code to work on AWS, I needed to change from In order for it to work with S3rver, I changed all references from key to Key. The rest of the S3 sending and receiving processes, such as profile photo, were not affected and work in both cases in s3rver and aws. I think the process used refers to the s3rver/lib/controllers/object.js Line 693 in 005feae
I think the simplest solution would be to check if the Key exists when key does not exist, because has 2 references when use s3rver/lib/controllers/object.js Lines 221 to 228 in 005feae
and s3rver/lib/controllers/object.js Lines 571 to 579 in 005feae
Maybe can use like: const key = ctx.params.key || ctx.params.Key; But for now it's all guesswork, I don't have the opportunity and time to analyze each process in depth. |
I submitted a pull request that allows this change without braking changes. #750 |
It still looks like the parameter name sent over the wire is lowercase. From the same file you linked in the JS SDK it takes the capitalized parameter name and sends it as lowercase: This aligns with the POST Object docs |
Following docs.aws.amazon.com, the key parameter should be Key. I did some tests with putObject and it works both ways. However when using
s3.createPresignedPost
usingKey
, it fails with S3rver and works on AWS and withkey
works in S3rver and fail on AWS.For internal testing, I decided to change all code references of S3rver to Key and my tests passed and the code worked on AWS.
I thought about sending a pull request, but the repository tests didn't pass yet.
I would like to know the opinion of the maintainer (@kherock) about the change. If it is of interest, I can make myself available to make the whole process work - with Key instead of key - in a future pull request.
The text was updated successfully, but these errors were encountered: