From 19d25d090507651db728b17cfadb6f9946014996 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Fri, 18 Sep 2020 10:30:06 -0400 Subject: [PATCH] fix(storage): complete fix for PostPolicy fields (#2887) 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 --- storage/integration_test.go | 2 +- storage/post_policy_v4.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/storage/integration_test.go b/storage/integration_test.go index 149ac2fc3bc..efa43dbcf3a 100644 --- a/storage/integration_test.go +++ b/storage/integration_test.go @@ -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) diff --git a/storage/post_policy_v4.go b/storage/post_policy_v4.go index 5abba9fc6dd..db9d1383849 100644 --- a/storage/post_policy_v4.go +++ b/storage/post_policy_v4.go @@ -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})