Fix PinLsCid and pins with maxdepth 0 after migration

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
Hector Sanjuan 2018-08-20 11:39:34 +02:00
parent 63fa1ba213
commit 6c28d6bf3e
2 changed files with 9 additions and 9 deletions

View File

@ -656,10 +656,9 @@ func (ipfs *Connector) PinLsCid(ctx context.Context, hash *cid.Cid) (api.IPFSPin
return api.IPFSPinStatusError, err
}
// Pin not found. Try next type
if err != nil {
continue
// Pin found. Do not keep looking.
if err == nil {
break
}
}

View File

@ -151,11 +151,12 @@ func (st *mapStateV4) next() migrateable {
pinsv5.Cid = v.Cid
pinsv5.Type = uint64(api.DataType)
pinsv5.Allocations = v.Allocations
if v.Recursive {
pinsv5.MaxDepth = -1
} else {
pinsv5.MaxDepth = 0
}
// Encountered pins with Recursive=false
// in previous states. Since we do not support
// non recursive pins yet, we fix it by
// harcoding MaxDepth.
pinsv5.MaxDepth = -1
// Options
pinsv5.Name = v.Name