From 54ea4377a878d0cf02658480bcc1377a569c169d Mon Sep 17 00:00:00 2001 From: Matthias Vach Date: Wed, 18 Sep 2024 16:09:19 +0200 Subject: [PATCH] Swift signed urls must not end with \n --- client/client_test.go | 3 +-- client/openstack_swift_client.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/client/client_test.go b/client/client_test.go index 586abb3f..f060e49f 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -110,8 +110,7 @@ var _ = Describe("S3CompatibleClient", func() { urlRegexp = "https://host-name/v1/swift_account/some-bucket/test-object-id" + `\?temp_url_sig=([a-f0-9]+)` + - `&temp_url_expires=([0-9]+)` + - "\n" + `&temp_url_expires=([0-9]+)` }) Context("when the action is GET", func() { diff --git a/client/openstack_swift_client.go b/client/openstack_swift_client.go index afc3e3c3..26203dd5 100644 --- a/client/openstack_swift_client.go +++ b/client/openstack_swift_client.go @@ -37,7 +37,7 @@ func (c *openstackSwiftS3Client) signedURL(action string, objectID string, expir h.Write([]byte(hmacBody)) signature := hex.EncodeToString(h.Sum(nil)) - url := fmt.Sprintf("https://%s%s?temp_url_sig=%s&temp_url_expires=%d\n", c.s3cliConfig.Host, path, signature, expires) + url := fmt.Sprintf("https://%s%s?temp_url_sig=%s&temp_url_expires=%d", c.s3cliConfig.Host, path, signature, expires) return url, nil }