fix: use path instead of filepath for S3 object paths on Windows (#7739)

fix: use path instead of filepath for S3 object paths on Windows (#7733)
This commit is contained in:
Chris Lu
2025-12-14 11:18:23 -08:00
committed by GitHub
parent eb860752e6
commit a77674ead3
5 changed files with 202 additions and 9 deletions

View File

@@ -146,7 +146,10 @@ func GetBucketAndObject(r *http.Request) (bucket, object string) {
// NormalizeObjectKey ensures the object key has a leading slash and no duplicate slashes.
// This normalizes keys from various sources (URL path, form values, etc.) to a consistent format.
// It also converts Windows-style backslashes to forward slashes for cross-platform compatibility.
func NormalizeObjectKey(object string) string {
// Convert Windows-style backslashes to forward slashes
object = strings.ReplaceAll(object, "\\", "/")
object = removeDuplicateSlashes(object)
if !strings.HasPrefix(object, "/") {
object = "/" + object