Skip to content

Commit

Permalink
fix(bbolt):decode entry when get entry by id
Browse files Browse the repository at this point in the history
  • Loading branch information
vimiix committed Jan 30, 2024
1 parent 7ff01b7 commit 64e37a0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ssx/bbolt/bbolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (r *Repo) TouchEntry(e *entry.Entry) error {
})
}

func (r *Repo) GetEntry(id uint64) (t *entry.Entry, err error) {
func (r *Repo) GetEntry(id uint64) (e *entry.Entry, err error) {
if err = r.open(); err != nil {
return
}
Expand All @@ -103,8 +103,12 @@ func (r *Repo) GetEntry(id uint64) (t *entry.Entry, err error) {
if len(bs) == 0 {
return errmsg.ErrEntryNotExist
}
t = &entry.Entry{}
return json.Unmarshal(bs, t)
var decodeErr error
e, decodeErr = decodeEntry(bs)
if decodeErr != nil {
return decodeErr
}
return nil
})
return
}
Expand Down

0 comments on commit 64e37a0

Please sign in to comment.