mirror of
https://github.com/versity/versitygw.git
synced 2026-02-08 03:10:43 +00:00
Merge pull request #1083 from versity/fix/headobject-versioning-not-allowed
fix: Changes HeadObject returned error type from MethodNotAllowed to …
This commit is contained in:
@@ -3632,10 +3632,14 @@ func (p *Posix) HeadObject(ctx context.Context, input *s3.HeadObjectInput) (*s3.
|
||||
|
||||
// if the specified object version is a delete marker, return MethodNotAllowed
|
||||
if isDelMarker {
|
||||
return &s3.HeadObjectOutput{
|
||||
DeleteMarker: getBoolPtr(true),
|
||||
LastModified: backend.GetTimePtr(fi.ModTime()),
|
||||
}, s3err.GetAPIError(s3err.ErrMethodNotAllowed)
|
||||
if versionId != "" {
|
||||
return &s3.HeadObjectOutput{
|
||||
DeleteMarker: getBoolPtr(true),
|
||||
LastModified: backend.GetTimePtr(fi.ModTime()),
|
||||
}, s3err.GetAPIError(s3err.ErrMethodNotAllowed)
|
||||
} else {
|
||||
return nil, s3err.GetAPIError(s3err.ErrNoSuchKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14461,6 +14461,16 @@ func Versioning_HeadObject_delete_marker(s *S3Conf) error {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx, cancel = context.WithTimeout(context.Background(), shortTimeout)
|
||||
_, err = s3client.HeadObject(ctx, &s3.HeadObjectInput{
|
||||
Bucket: &bucket,
|
||||
Key: &obj,
|
||||
})
|
||||
cancel()
|
||||
if err := checkSdkApiErr(err, "NotFound"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}, withVersioning(types.BucketVersioningStatusEnabled))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user