fix: omit null version id for suspended buckets

Keep null as the stored object version ID when bucket versioning is suspended, but omit x-amz-version-id from the PutObject response to match Amazon S3.

Update the existing versioning integration coverage to distinguish the PutObject response from the null version returned by ListObjectVersions, and verify empty response headers are not rendered.

Fixes #2164

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hgichon
2026-07-14 19:21:20 -07:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 9f6cb2a760
commit 8a3dbcf97d
4 changed files with 24 additions and 13 deletions
+3 -3
View File
@@ -336,9 +336,9 @@ func ListObjectVersions_containing_null_versionId_obj(s *S3Conf) error {
return err
}
if getString(out.res.VersionId) != nullVersionId {
return fmt.Errorf("expected the uploaded object versionId to be %v, instead got %v",
nullVersionId, getString(out.res.VersionId))
if out.res.VersionId != nil {
return fmt.Errorf("expected PutObject response to omit versionId, instead got %v",
getString(out.res.VersionId))
}
versions[0].IsLatest = getBoolPtr(false)
+6 -6
View File
@@ -64,9 +64,9 @@ func Versioning_PutObject_suspended_null_versionId_obj(s *S3Conf) error {
return err
}
if getString(out.res.VersionId) != nullVersionId {
return fmt.Errorf("expected the uploaded object versionId to be %v, instead got %v",
nullVersionId, getString(out.res.VersionId))
if out.res.VersionId != nil {
return fmt.Errorf("expected PutObject response to omit versionId, instead got %v",
getString(out.res.VersionId))
}
return nil
@@ -161,9 +161,9 @@ func Versioning_PutObject_overwrite_null_versionId_obj(s *S3Conf) error {
return err
}
if getString(out.res.VersionId) != nullVersionId {
return fmt.Errorf("expected the uploaded object versionId to be %v, insted got %v",
nullVersionId, getString(out.res.VersionId))
if out.res.VersionId != nil {
return fmt.Errorf("expected PutObject response to omit versionId, instead got %v",
getString(out.res.VersionId))
}
versions[0].IsLatest = getBoolPtr(false)