mirror of
https://github.com/versity/versitygw.git
synced 2026-01-07 12:15:18 +00:00
fix: Returns NoSuchKey error for GetObject, if verionId is not specified and the latest version is a delete marker
This commit is contained in:
@@ -2750,7 +2750,7 @@ func (p *Posix) GetObject(_ context.Context, input *s3.GetObjectInput) (*s3.GetO
|
||||
return nil, s3err.GetAPIError(s3err.ErrNoSuchKey)
|
||||
}
|
||||
|
||||
if versionId != "" {
|
||||
if p.versioningEnabled() {
|
||||
isDelMarker, err := p.isObjDeleteMarker(bucket, object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -2758,10 +2758,15 @@ func (p *Posix) GetObject(_ context.Context, input *s3.GetObjectInput) (*s3.GetO
|
||||
|
||||
// if the specified object version is a delete marker, return MethodNotAllowed
|
||||
if isDelMarker {
|
||||
if versionId != "" {
|
||||
err = s3err.GetAPIError(s3err.ErrMethodNotAllowed)
|
||||
} else {
|
||||
err = s3err.GetAPIError(s3err.ErrNoSuchKey)
|
||||
}
|
||||
return &s3.GetObjectOutput{
|
||||
DeleteMarker: getBoolPtr(true),
|
||||
LastModified: backend.GetTimePtr(fi.ModTime()),
|
||||
}, s3err.GetAPIError(s3err.ErrMethodNotAllowed)
|
||||
}, err
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user