Skip to content

Commit

Permalink
add support for '*' in etag match
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Jun 18, 2024
1 parent fa174cb commit 0b004e3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions api-put-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ func (opts *PutObjectOptions) SetMatchETag(etag string) {
if opts.customHeaders == nil {
opts.customHeaders = http.Header{}
}
opts.customHeaders.Set("If-Match", "\""+etag+"\"")
if etag == "*" {
opts.customHeaders.Set("If-Match", "*")
} else {
opts.customHeaders.Set("If-Match", "\""+etag+"\"")
}
}

// SetMatchETagExcept if etag does not match while PUT MinIO returns an
Expand All @@ -116,7 +120,11 @@ func (opts *PutObjectOptions) SetMatchETagExcept(etag string) {
if opts.customHeaders == nil {
opts.customHeaders = http.Header{}
}
opts.customHeaders.Set("If-None-Match", "\""+etag+"\"")
if etag == "*" {
opts.customHeaders.Set("If-None-Match", "*")
} else {
opts.customHeaders.Set("If-None-Match", "\""+etag+"\"")
}
}

// getNumThreads - gets the number of threads to be used in the multipart
Expand Down

0 comments on commit 0b004e3

Please sign in to comment.