-
Notifications
You must be signed in to change notification settings - Fork 650
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
Added a new method SetUserMetadata to the PostPolicy #839
Conversation
post-policy.go
Outdated
@@ -167,6 +167,26 @@ func (p *PostPolicy) SetSuccessStatusAction(status string) error { | |||
return nil | |||
} | |||
|
|||
func (p *PostPolicy) SetUserSpecifiedMetadata(key string, value string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method PostPolicy.SetUserSpecifiedMetadata should have comment or be unexported
You should add tests in |
Hi @harshavardhana, I am trying to run those
I am on antergos (ArchLinux) running:
Am I missing something ? (I ran all the |
Hey @hnb2, I downloaded your PR locally, function_tests.go compiles fine in my machine. Can you check if your minio-go dir is under |
Hey @vadmeste , thanks for answering. I made it work by modifying (locally) the minio imports to use "hnb2/" instead of "minio/" because I am using my fork. I guess that your solution is cleaner. |
post-policy.go
Outdated
@@ -167,6 +167,28 @@ func (p *PostPolicy) SetSuccessStatusAction(status string) error { | |||
return nil | |||
} | |||
|
|||
// SetUserSpecifiedMetadata - Set user specified metadata as a key/value | |||
// couple. Can be retrieved through a HEAD request or an event. | |||
func (p *PostPolicy) SetUserSpecifiedMetadata(key string, value string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't better to call this SetUserMetadata(), it will be already consistent with other simliar APIs (like SetContentType, etc..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, will push the changes tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to squash your changes and update the PR title here. Thanks @hnb2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harshavardhana Done
552a5c5
to
7b4a3ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hnb2 You can call it SetMetadata
instead of SetUserMetadata
@krishnasrinivas Ok I will push this change + fix the conflicts |
@krishnasrinivas regarding the method name, I see that this PR has been merged with the name |
No, SetUserMetadata is better |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi there,
here is a PR for a new feature I need for a project I am working on.
Feature
SetUserSpecifiedMetadata(key string, value string)
allows you to add user specified metadata following this guide which mention:Contributing
I went through the contributing doc and ran
SERVER_ENDPOINT=xxx ACCESS_KEY=xxx SECRET_KEY=xxx go test -race ./...
successfuly and rango fmt
.But I do not have any unit tests though as the file
post-policy.go
does not have any I am not sure how you guys would like it to be tested, if you could please provide me some pointers.I tested the feature itself, it is working and being used in staging (the header is set properly and retrieved through the Minio event notification when the upload is completed, and through
HEAD
as well).