Skip to content

Commit

Permalink
fix(storage): complete fix for PostPolicy fields (#2887)
Browse files Browse the repository at this point in the history
In #2769 we neglected to add these conditions to the returned
policyFields that the end user uses to populate the request. This
resulted in an integration test failing. This PR fixes the issue.

Fixes #2882
  • Loading branch information
tritone committed Sep 18, 2020
1 parent 7598c4d commit 19d25d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion storage/integration_test.go
Expand Up @@ -3389,7 +3389,7 @@ func TestIntegration_PostPolicyV4(t *testing.T) {
}
if g, w := res.StatusCode, statusCodeToRespond; g != w {
blob, _ := httputil.DumpResponse(res, true)
t.Errorf("Status code in response mismatch: got %d want %d\nBody: %s", g, w, blob)
t.Fatalf("Status code in response mismatch: got %d want %d\nBody: %s", g, w, blob)
}
io.Copy(ioutil.Discard, res.Body)

Expand Down
6 changes: 5 additions & 1 deletion storage/post_policy_v4.go
Expand Up @@ -267,8 +267,12 @@ func GenerateSignedPostPolicyV4(bucket, object string, opts *PostPolicyV4Options
"x-goog-date": now.Format(iso8601),
"x-goog-credential": opts.GoogleAccessID + "/" + YYYYMMDD + "/auto/storage/goog4_request",
"x-goog-algorithm": "GOOG4-RSA-SHA256",
"success_action_redirect": descFields.RedirectToURLOnSuccess,
"acl": descFields.ACL,
"cache-control": descFields.CacheControl,
"content-disposition": descFields.ContentDisposition,
"content-encoding": descFields.ContentEncoding,
"content-type": descFields.ContentType,
"success_action_redirect": descFields.RedirectToURLOnSuccess,
}
for key, value := range descFields.Metadata {
conds = append(conds, &singleValueCondition{key, value})
Expand Down

0 comments on commit 19d25d0

Please sign in to comment.