Skip to content

Commit 0b004e3

Browse files
add support for '*' in etag match
1 parent fa174cb commit 0b004e3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

api-put-object.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ func (opts *PutObjectOptions) SetMatchETag(etag string) {
106106
if opts.customHeaders == nil {
107107
opts.customHeaders = http.Header{}
108108
}
109-
opts.customHeaders.Set("If-Match", "\""+etag+"\"")
109+
if etag == "*" {
110+
opts.customHeaders.Set("If-Match", "*")
111+
} else {
112+
opts.customHeaders.Set("If-Match", "\""+etag+"\"")
113+
}
110114
}
111115

112116
// SetMatchETagExcept if etag does not match while PUT MinIO returns an
@@ -116,7 +120,11 @@ func (opts *PutObjectOptions) SetMatchETagExcept(etag string) {
116120
if opts.customHeaders == nil {
117121
opts.customHeaders = http.Header{}
118122
}
119-
opts.customHeaders.Set("If-None-Match", "\""+etag+"\"")
123+
if etag == "*" {
124+
opts.customHeaders.Set("If-None-Match", "*")
125+
} else {
126+
opts.customHeaders.Set("If-None-Match", "\""+etag+"\"")
127+
}
120128
}
121129

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

0 commit comments

Comments
 (0)