AdRoll / goamz

Fork of the GOAMZ version developed within Canonical with additional functionality with DynamoDB
https://wiki.ubuntu.com/goamz
Other
401 stars 213 forks source link

fix signing of URLs with query parameters with empty value #423

Closed levinalex closed 8 years ago

levinalex commented 8 years ago

this fixes V4 signing of URLs with query parameters with an empty value. (from #422)

From the AWS Documentation:

For each parameter, append the URI-encoded parameter name, followed by the character '=' (ASCII code 61), followed by the URI-encoded parameter value. Use an empty string for parameters that have no value.

alimoeeny commented 8 years ago

Thanks @levinalex I am surprised this change was needed, what was the case for empty values for then?

levinalex commented 8 years ago

it was needed because InitMulti hit that case:

from s3/multi.go:

func (b *Bucket) InitMulti(key string, contType string, perm ACL, options Options) (*Multi, error) {
    ...
    params := map[string][]string{
        "uploads": {""},
    }
    ...

If you're asking why empty query parameters were handled specially in the older version: looks to be a leftover from before this bug was fixed the last time: https://github.com/nalin-humin/goamz/commit/69802b744811077488714d3d2f7b34985987df98

levinalex commented 8 years ago

also: thank you for merging :+1: