Skip to content

Commit

Permalink
meta: fix the issue that zero field of Format not applied in refreshS…
Browse files Browse the repository at this point in the history
…ession (#4033)
  • Loading branch information
SandyXSD authored Aug 31, 2023
1 parent 94d9c0f commit 50e0c30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pkg/meta/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,16 @@ func (m *baseMeta) Load(checkVersion bool) (*Format, error) {
if err != nil {
return nil, err
}
if err = json.Unmarshal(body, &m.fmt); err != nil {
var format = new(Format)
if err = json.Unmarshal(body, format); err != nil {
return nil, fmt.Errorf("json: %s", err)
}
if checkVersion {
if err = m.fmt.CheckVersion(); err != nil {
if err = format.CheckVersion(); err != nil {
return nil, fmt.Errorf("check version: %s", err)
}
}
m.fmt = *format
return &m.fmt, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/meta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Format struct {
Inodes uint64 `json:",omitempty"`
EncryptKey string `json:",omitempty"`
KeyEncrypted bool `json:",omitempty"`
TrashDays int `json:",omitempty"`
TrashDays int
MetaVersion int `json:",omitempty"`
MinClientVersion string `json:",omitempty"`
MaxClientVersion string `json:",omitempty"`
Expand Down

0 comments on commit 50e0c30

Please sign in to comment.