[#219] Return ETag in quotes #255
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-s3-gw#255
Loading…
Reference in a new issue
No description provided.
Delete branch "mbiryukova/frostfs-s3-gw:feature/return_etag_in_quotes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #219
Signed-off-by: Marina Biryukova m.biryukova@yadro.com
Please don't forget update changelog
@ -119,9 +120,9 @@ func (o *ObjectInfo) Address() oid.Address {
func (o *ObjectInfo) ETag(md5Enabled bool) string {
It seems we have to use this method in all places where we use
HashSum
orMD5Sum
for read directly. See 1, 2, 3 etc.Probably this also related to #205 (we return md5 not in all cases where we should @alexvanin )
Agree. All places with hashsum should use ETag value according to md5 setting.
@ -123,2 +123,3 @@
return fmt.Sprintf("%q", o.MD5Sum)
}
return o.HashSum
return fmt.Sprintf("%q", o.HashSum)
I would suggest to use
because benchmarks
gives
@ -304,2 +304,3 @@
return w.Header().Get(api.ETag), partBody
etag := w.Header().Get(api.ETag)
return etag[1 : len(etag)-1], partBody
It's better to handle quoted parts etag in
CompleteMultipartUploadHandler
because it's valid to pass quoted parts etag in complete multipart request (see examples)a183622a6f
toee4637c6db
ee4637c6db
to11e99be812
11e99be812
tod2cdf1e88d
d2cdf1e88d
to03746c9361
@ -243,1 +241,3 @@
return fmt.Errorf("%w: etag mismatched: '%s', '%s'", errors.GetAPIError(errors.ErrPreconditionFailed), args.IfMatch, info.HashSum)
func checkPreconditions(info *data.ObjectInfo, args *conditionalArgs, md5Enabled bool) error {
etag := strings.Trim(info.ETag(md5Enabled), "\"")
if len(args.IfMatch) > 0 && args.IfMatch != etag {
To compare etag this way, we have to be sure that
args.IfMatch
/args.IfNoneMatch
don't contain quotes. But not it isn't true. See03746c9361/api/handler/copy.go (L293)
@ -120,3 +120,3 @@
func (o *ObjectInfo) ETag(md5Enabled bool) string {
if md5Enabled && len(o.MD5Sum) > 0 {
return o.MD5Sum
return "\"" + o.MD5Sum + "\""
What about return values from this function without quotes?
It allows us not to trim in cases like this.
We can introduce new functions, for example
and use them in places like this and this
The same for
PartInfo
struct03746c9361
to2813c3adfe
2813c3adfe
tof35602da16
LGTM
f35602da16
tob28ecef43b