diff options
| author | Sandro Jäckel <sandro.jaeckel@sap.com> | 2022-02-07 11:18:51 +0100 |
|---|---|---|
| committer | Stefan Majewsky <stefan.majewsky@sap.com> | 2022-02-07 11:18:51 +0100 |
| commit | 9e4ca6d1af64e72f60dc40d587f16c1b203357b4 (patch) | |
| tree | a8297deca73f723e6921dc5bdde8ebcb66f24c1e /request.go | |
| parent | 79df56a219c657d51327ca95a1696cd329629665 (diff) | |
| download | go-schwift-9e4ca6d1af64e72f60dc40d587f16c1b203357b4.tar.gz | |
do not mangle non-standard object paths
If the object path contains multiple slashes back-to-back, these used to
be wrongly merged by net.url.URL.String(). For example,
account = "AUTH_aaa"
container = "ccc"
object = "foo///bar"
would become something like
https://swift.example.com/v1/AUTH_aaa/ccc/foo/bar
With this change, we produce a more correct URL:
https://swift.example.com/v1/AUTH_aaa/ccc/foo%2f%2f%2fbar
Diffstat (limited to 'request.go')
| -rw-r--r-- | request.go | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -98,7 +98,9 @@ func (r Request) URL(backend Backend, values url.Values) (string, error) { if strings.Contains(r.ContainerName, "/") { return "", ErrMalformedContainerName } - uri.Path += r.ContainerName + "/" + r.ObjectName + // Encode path so that double slashes are encoded and handled correct by backend server + uri.RawPath = uri.Path + r.ContainerName + "/" + url.PathEscape(r.ObjectName) + uri.Path = uri.Path + r.ContainerName + "/" + r.ObjectName } uri.RawQuery = values.Encode() |
