-
Notifications
You must be signed in to change notification settings - Fork 657
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
Add new API PresignedHeadObject method. #798
Conversation
### PresignedHeadObject(bucketName, objectName string, expiry time.Duration, reqParams url.Values) (*url.URL, error) | ||
|
||
Generates a presigned URL for HTTP HEAD operations. Browsers/Mobile clients may point to this URL to directly get metadata from objects even if the bucket is private. This presigned URL can have an associated expiration time in seconds after which it is no longer operational. The default expiry is set to 7 days. | ||
|
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.
shouldn't this read - The maximum expiry is set to 7 days?
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.
No default is 7 days if not set that is.
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.
But also the maximum is 7 days AFAIK
api-presigned.go
Outdated
// PresignedPutObject - Returns a presigned URL to upload an object without credentials. | ||
// Expires maximum is 7days - ie. 604800 and minimum is 1. | ||
func (c Client) PresignedPutObject(bucketName string, objectName string, expires time.Duration) (u *url.URL, err error) { | ||
return c.presignURL("PUT", bucketName, objectName, expires, nil) | ||
} | ||
|
||
// Presign - returns a presigned URL for any http method of your choice. | ||
// Expires maximum in 7days - i.e 604800 and minimum in 1. |
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.
Expires maximum in 7days -> Expires maximum is 7 days.
api-presigned.go
Outdated
// Expires maximum is 7days - ie. 604800 and minimum is 1. | ||
// PresignedPutObject - Returns a presigned URL to upload an object | ||
// without credentials. URL can have a maximum expiry of upto 7days | ||
// or a minimum of 1sec, if expiry duration is set to 0 URL a |
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.
I didn't test it but after reading the code, it seems setting 0 to expires returns an error (invoked by isValidExpiry() in presignURL())
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.
I see looks like behavior has changed.. @vadmeste - let me change the comment to reflect the new changes.
api-presigned.go
Outdated
// headers using the query parameters. | ||
// data without credentials. URL can have a maximum expiry of | ||
// upto 7days or a minimum of 1sec, if expiry duration is set to 0 | ||
// URL a maximum value of 7 days is automatically choosen. Additionally |
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.
+// upto 7days or a minimum of 1sec, if expiry duration is set to 0
+// URL a maximum value of 7 days is automatically choosen.
Should be:
+// upto 7days or a minimum of 1sec, if expiry duration is set to 0
+// URL a maximum value of 7 days is automatically choosen.
Ditto for the other 3 function header comments
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
@vadmeste waiting on your review. |
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
This PR borrows original work from @dmage in PR #770