mirror of
https://github.com/minio/minio.git
synced 2025-10-28 23:35:01 -04:00
fix: return error on conditional write for non existing object (#21550)
This commit is contained in:
parent
9fdbf6fe83
commit
558fc1c09c
@ -1277,6 +1277,11 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st
|
||||
if err != nil && !isErrVersionNotFound(err) && !isErrObjectNotFound(err) && !isErrReadQuorum(err) {
|
||||
return objInfo, err
|
||||
}
|
||||
|
||||
// if object doesn't exist and not a replication request return error for conditional requests
|
||||
if err != nil && !opts.ReplicationRequest {
|
||||
return objInfo, err
|
||||
}
|
||||
}
|
||||
|
||||
// Validate input data size and it can never be less than -1.
|
||||
|
||||
@ -414,12 +414,16 @@ func putOptsFromHeaders(ctx context.Context, hdr http.Header, metadata map[strin
|
||||
if err != nil {
|
||||
return ObjectOptions{}, err
|
||||
}
|
||||
return ObjectOptions{
|
||||
op := ObjectOptions{
|
||||
ServerSideEncryption: sseKms,
|
||||
UserDefined: metadata,
|
||||
MTime: mtime,
|
||||
PreserveETag: etag,
|
||||
}, nil
|
||||
}
|
||||
if _, ok := hdr[xhttp.MinIOSourceReplicationRequest]; ok {
|
||||
op.ReplicationRequest = true
|
||||
}
|
||||
return op, nil
|
||||
}
|
||||
// default case of passing encryption headers and UserDefined metadata to backend
|
||||
opts, err = getDefaultOpts(hdr, false, metadata)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user