fix: use path.Clean instead of filepath.Clean for cross-platform URI canonicalization
filepath.Clean converts forward slashes to backslashes on Windows, which breaks the AWS V4 signature calculation by corrupting the canonical URI. Use path.Clean which always uses forward slashes, matching the S3 API expectation.
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
p "path"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -68,7 +68,7 @@ func writeURI(w io.Writer, r *http.Request) {
|
||||
path = path[:len(path)-len(r.URL.RawQuery)-1]
|
||||
}
|
||||
slash := strings.HasSuffix(path, "/")
|
||||
path = filepath.Clean(path)
|
||||
path = p.Clean(path)
|
||||
if path != "/" && slash {
|
||||
path += "/"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user