Skip to content

Commit

Permalink
fix: cid is empty str.
Browse files Browse the repository at this point in the history
  • Loading branch information
cody committed Dec 30, 2024
1 parent 1125003 commit f52bac8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/commands/cidstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ var addCidCmd = &cmds.Command{
}

for _, v := range cids {
if v == "" {
continue
}
err = batch.Put(req.Context, datastore.NewKey(NewGatewayFilterKey(v)), []byte(v))
if err != nil {
return cmds.EmitOnce(res, err.Error())
Expand Down Expand Up @@ -220,6 +223,9 @@ func NewGatewayFilterKey(key string) string {

func validateCIDs(cids []string) error {
for _, c := range cids {
if c == "" {
continue
}
_, err := cid.Decode(c)
if err != nil {
return fmt.Errorf("Invalid CID: %s", c)
Expand Down

0 comments on commit f52bac8

Please sign in to comment.