diff --git a/api/data/info.go b/api/data/info.go index b197a54..b8e48fc 100644 --- a/api/data/info.go +++ b/api/data/info.go @@ -46,6 +46,7 @@ type ( // BucketSettings stores settings such as versioning. BucketSettings struct { + IsNoneStatus bool VersioningEnabled bool `json:"versioning_enabled"` LockConfiguration *ObjectLockConfiguration `json:"lock_configuration"` } diff --git a/api/handler/versioning.go b/api/handler/versioning.go index 30959db..70e41fa 100644 --- a/api/handler/versioning.go +++ b/api/handler/versioning.go @@ -34,6 +34,7 @@ func (h *handler) PutBucketVersioningHandler(w http.ResponseWriter, r *http.Requ } settings.VersioningEnabled = configuration.Status == "Enabled" + settings.IsNoneStatus = false p := &layer.PutSettingsParams{ BktInfo: bktInfo, @@ -76,7 +77,7 @@ func (h *handler) GetBucketVersioningHandler(w http.ResponseWriter, r *http.Requ func formVersioningConfiguration(settings *data.BucketSettings) *VersioningConfiguration { res := &VersioningConfiguration{} - if settings == nil { + if settings.IsNoneStatus { return res } if settings.VersioningEnabled { diff --git a/api/layer/system_object.go b/api/layer/system_object.go index 854cc07..1c13655 100644 --- a/api/layer/system_object.go +++ b/api/layer/system_object.go @@ -245,6 +245,7 @@ func (n *layer) GetBucketSettings(ctx context.Context, bktInfo *data.BucketInfo) if !errors.IsS3Error(err, errors.ErrNoSuchKey) { return nil, err } + settings.IsNoneStatus = true } else if err = json.Unmarshal(obj.Payload(), settings); err != nil { return nil, err }