[#626] Fix ALREADY REMOVED response status code
All checks were successful
/ DCO (pull_request) Successful in 34s
/ Vulncheck (pull_request) Successful in 1m3s
/ Builds (pull_request) Successful in 1m24s
/ OCI image (pull_request) Successful in 2m9s
/ Lint (pull_request) Successful in 2m26s
/ Tests (pull_request) Successful in 1m13s

Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
Pavel Pogodaev 2025-02-07 15:11:46 +03:00
parent 592f4cada0
commit 102e686111
2 changed files with 14 additions and 0 deletions

View file

@ -197,6 +197,18 @@ func TestGetObject(t *testing.T) {
getObjectAssertS3Error(hc, bktName, objName, emptyVersion, apierr.ErrNoSuchKey)
}
func TestGetDeletedObject(t *testing.T) {
hc := prepareHandlerContext(t)
bktName, objName := "bucket", "obj"
createBucketAndObject(hc, bktName, objName)
putObject(hc, bktName, objName)
checkFound(hc.t, hc, bktName, objName, emptyVersion)
deleteObject(hc.t, hc, bktName, objName, emptyVersion)
getObjectAssertS3Error(hc, bktName, objName, emptyVersion, apierr.ErrNoSuchKey)
}
func TestGetObjectEnabledMD5(t *testing.T) {
hc := prepareHandlerContext(t)
bktName, objName := "bucket", "obj"

View file

@ -409,6 +409,8 @@ func (n *Layer) GetObject(ctx context.Context, p *GetObjectParams) (*ObjectPaylo
} else {
err = fmt.Errorf("%w: %s", apierr.GetAPIError(apierr.ErrNoSuchKey), err.Error())
}
} else if client.IsErrObjectAlreadyRemoved(err) {
err = fmt.Errorf("%w: %s", apierr.GetAPIError(apierr.ErrNoSuchKey), err.Error())
}
return nil, fmt.Errorf("init object payload reader: %w", err)