fix: cancel retrieval deal - disallow negative deal ID
This commit is contained in:
parent
36c3086376
commit
b13f6a3209
@ -1996,7 +1996,7 @@ var clientCancelRetrievalDeal = &cli.Command{
|
|||||||
defer closer()
|
defer closer()
|
||||||
ctx := ReqContext(cctx)
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
if cctx.Int64("dealid") <= 0 {
|
if cctx.Int64("dealid") < 0 {
|
||||||
return errors.New("deal id cannot be negative")
|
return errors.New("deal id cannot be negative")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,12 +489,12 @@ func (a *API) ClientCancelRetrievalDeal(ctx context.Context, dealid retrievalmar
|
|||||||
select {
|
select {
|
||||||
case err := <-cerr:
|
case err := <-cerr:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("canceling retrieval deal erred: %w", err)
|
return xerrors.Errorf("failed to cancel retrieval deal: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return xerrors.Errorf("canceling retrieval deal context timeout: %w", ctx.Err())
|
return xerrors.Errorf("context timeout while canceling retrieval deal: %w", ctx.Err())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user