[#462] Fix None versioning status
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
0e37242b65
commit
faa3c65290
3 changed files with 4 additions and 1 deletions
|
@ -46,6 +46,7 @@ type (
|
||||||
|
|
||||||
// BucketSettings stores settings such as versioning.
|
// BucketSettings stores settings such as versioning.
|
||||||
BucketSettings struct {
|
BucketSettings struct {
|
||||||
|
IsNoneStatus bool
|
||||||
VersioningEnabled bool `json:"versioning_enabled"`
|
VersioningEnabled bool `json:"versioning_enabled"`
|
||||||
LockConfiguration *ObjectLockConfiguration `json:"lock_configuration"`
|
LockConfiguration *ObjectLockConfiguration `json:"lock_configuration"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ func (h *handler) PutBucketVersioningHandler(w http.ResponseWriter, r *http.Requ
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.VersioningEnabled = configuration.Status == "Enabled"
|
settings.VersioningEnabled = configuration.Status == "Enabled"
|
||||||
|
settings.IsNoneStatus = false
|
||||||
|
|
||||||
p := &layer.PutSettingsParams{
|
p := &layer.PutSettingsParams{
|
||||||
BktInfo: bktInfo,
|
BktInfo: bktInfo,
|
||||||
|
@ -76,7 +77,7 @@ func (h *handler) GetBucketVersioningHandler(w http.ResponseWriter, r *http.Requ
|
||||||
|
|
||||||
func formVersioningConfiguration(settings *data.BucketSettings) *VersioningConfiguration {
|
func formVersioningConfiguration(settings *data.BucketSettings) *VersioningConfiguration {
|
||||||
res := &VersioningConfiguration{}
|
res := &VersioningConfiguration{}
|
||||||
if settings == nil {
|
if settings.IsNoneStatus {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
if settings.VersioningEnabled {
|
if settings.VersioningEnabled {
|
||||||
|
|
|
@ -245,6 +245,7 @@ func (n *layer) GetBucketSettings(ctx context.Context, bktInfo *data.BucketInfo)
|
||||||
if !errors.IsS3Error(err, errors.ErrNoSuchKey) {
|
if !errors.IsS3Error(err, errors.ErrNoSuchKey) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
settings.IsNoneStatus = true
|
||||||
} else if err = json.Unmarshal(obj.Payload(), settings); err != nil {
|
} else if err = json.Unmarshal(obj.Payload(), settings); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue