fix: correct HeadObject restore status for offline objects in scoutfs

Fixes #2030

When an object has offline blocks, the restore status was incorrectly set to `ongoing-request="false"` instead of omitting the header entirely, which causes s3 clients fail on parsing the x-amz-restore header.
Remove the incorrect `stageNotInProgress` constant and simplify the `requestOngoing` initialization to reflect the correct default.
This commit is contained in:
niksis02
2026-04-09 19:15:31 +04:00
parent e995e21982
commit 48bfa9f4cf
2 changed files with 5 additions and 8 deletions
+4 -7
View File
@@ -114,9 +114,8 @@ func New(rootdir string, opts ScoutfsOpts) (*ScoutFS, error) {
}
const (
stageComplete = "ongoing-request=\"false\", expiry-date=\"Fri, 2 Dec 2050 00:00:00 GMT\""
stageInProgress = "ongoing-request=\"true\""
stageNotInProgress = "ongoing-request=\"false\""
stageComplete = "ongoing-request=\"false\", expiry-date=\"Fri, 2 Dec 2050 00:00:00 GMT\""
stageInProgress = "ongoing-request=\"true\""
)
const (
@@ -196,9 +195,7 @@ func (s *ScoutFS) HeadObject(ctx context.Context, input *s3.HeadObjectInput) (*s
objPath := filepath.Join(*input.Bucket, *input.Key)
stclass := types.StorageClassStandard
requestOngoing := ""
requestOngoing = stageComplete
requestOngoing := stageComplete
// Check if there are any offline exents associated with this file.
// If so, we will set storage class to glacier.
@@ -211,7 +208,7 @@ func (s *ScoutFS) HeadObject(ctx context.Context, input *s3.HeadObjectInput) (*s
}
if st.Offline_blocks != 0 {
stclass = types.StorageClassGlacier
requestOngoing = stageNotInProgress
requestOngoing = ""
ok, err := isStaging(objPath)
if errors.Is(err, fs.ErrNotExist) {