support ETag value to be '*' (#19682)

This supports '*' as per behavior to
comply with AWS S3 behavior for

- 'If-Match: *'
- 'If-None-Match: *'
This commit is contained in:
Harshavardhana 2024-05-06 17:08:42 -07:00 committed by GitHub
parent 847ee5ac45
commit 888d2bb1d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import (
"net/http"
"regexp"
"strconv"
"strings"
"time"
"github.com/minio/minio/internal/amztime"
@ -325,6 +326,9 @@ func canonicalizeETag(etag string) string {
// isETagEqual return true if the canonical representations of two ETag strings
// are equal, false otherwise
func isETagEqual(left, right string) bool {
if strings.TrimSpace(right) == "*" {
return true
}
return canonicalizeETag(left) == canonicalizeETag(right)
}