1
0
mirror of https://github.com/minio/mc.git synced 2025-11-10 13:42:32 +03:00

fix: make sure to set the right sse-kms key (#4967)

This commit is contained in:
Harshavardhana
2024-06-24 12:40:33 -07:00
committed by GitHub
parent dda9e96887
commit 3548007d5b
2 changed files with 45 additions and 8 deletions

View File

@@ -200,26 +200,25 @@ func parseSSEKey(sseKey string, keyType sseKeyType) (
separatorIndex := bytes.LastIndex(sseKeyBytes, []byte("="))
if separatorIndex < 0 {
if keyType == sseS3 {
alias, prefix = splitKey(sseKey)
return
}
err = errSSEKeyMissing().Trace(sseKey)
return
}
encodedKey := string(sseKeyBytes[separatorIndex+1:])
if separatorIndex == len(sseKeyBytes)-1 {
err = errSSEKeyMissing().Trace(sseKey)
return
}
encodedKey := string(sseKeyBytes[separatorIndex+1:])
alias, prefix = splitKey(string(sseKeyBytes[:separatorIndex]))
if keyType == sseS3 {
return
}
if keyType == sseKMS {
if !validKMSKeyName(encodedKey) {
err = errSSEKMSKeyFormat(fmt.Sprintf("Key (%s) is badly formatted.", encodedKey)).Trace(sseKey)
}
key = encodedKey
return
}