Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/cid-pk' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
457813723 committed Mar 7, 2024
2 parents 0a9e015 + ac0f4a1 commit 97fcb7f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions http_server/handle/upgradeCid.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,18 +291,22 @@ func (h *HttpHandle) getOldCid() (oldCids []OldCid, err error) {
oldCidPath := "./conf/old_cid.json"
file, err := ioutil.ReadFile(oldCidPath)
if err != nil {
log.Fatalf("Some error occured while reading file. Error: %s", err)
err = fmt.Errorf("old cid file not found")

return
}
err = json.Unmarshal(file, &oldCids)
if err != nil {
log.Fatalf("Error occured during unmarshaling. Error: %s", err.Error())
fmt.Errorf("old cid file content is error")
return
}
return
}
func (h *HttpHandle) updateOldCid(content string) (err error) {
oldCidPath := "./conf/old_cid.json"
err = ioutil.WriteFile(oldCidPath, []byte(content), 0644)
if err = ioutil.WriteFile(oldCidPath, []byte(content), 0644); err != nil {
return fmt.Errorf("write old cid file err")
}

return
}

0 comments on commit 97fcb7f

Please sign in to comment.