From dbedf33b9fa830e4828630c603e91640822657fa Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 9 Oct 2018 13:05:18 +0100 Subject: [PATCH] s3: fix v2 signer on files with spaces - fixes #2438 Before this fix the v2 signer was failing for files with spaces in. --- backend/s3/v2sign.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/backend/s3/v2sign.go b/backend/s3/v2sign.go index 23048ede9..2c22378e3 100644 --- a/backend/s3/v2sign.go +++ b/backend/s3/v2sign.go @@ -44,16 +44,7 @@ func sign(AccessKey, SecretKey string, req *http.Request) { req.Header.Set("Date", date) // Sort out URI - uri := req.URL.Opaque - if uri != "" { - if strings.HasPrefix(uri, "//") { - // Strip off //host/uri - uri = "/" + strings.Join(strings.Split(uri, "/")[3:], "/") - req.URL.Opaque = uri // reset to plain URI otherwise Ceph gets confused - } - } else { - uri = req.URL.Path - } + uri := req.URL.EscapedPath() if uri == "" { uri = "/" }