From 9a180cece75419e29bae298f9b5a692f8a08841f Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 2 Jul 2025 18:49:02 +0200 Subject: [PATCH] Some paths like url2Stat will send resource with backslashes on windows (#5226) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will cause key paths to mismatch and not be sent. Example: ``` λ go build&&mc stat -enc-c="play/testbucket/=MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDA" play/testbucket/mc Name : mc Date : 2025-07-02 17:52:42 CEST Size : 43 MiB ETag : 398345f23dc2ad4dd277e437e6ca7a1d-3 Type : file Encryption: SSE-C Metadata : Content-Type: application/x-msdownload ``` --- cmd/encryption-methods.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/encryption-methods.go b/cmd/encryption-methods.go index fd3a1bb7..5ae28649 100644 --- a/cmd/encryption-methods.go +++ b/cmd/encryption-methods.go @@ -22,6 +22,7 @@ import ( "encoding/base64" "encoding/hex" "fmt" + "path/filepath" "sort" "strings" @@ -60,6 +61,7 @@ func (p byPrefixLength) Swap(i, j int) { p[i], p[j] = p[j], p[i] } // get SSE Key if object prefix matches with given resource. func getSSE(resource string, encKeys []prefixSSEPair) encrypt.ServerSide { + resource = filepath.ToSlash(resource) for _, k := range encKeys { if strings.HasPrefix(resource, k.Prefix) { return k.SSE