Skip to content

Commit

Permalink
Fix PinLsCid and pins with maxdepth 0 after migration
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
  • Loading branch information
hsanjuan committed Aug 20, 2018
1 parent 63fa1ba commit 6c28d6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions ipfsconn/ipfshttp/ipfshttp.go
Expand Up @@ -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
}
}

Expand Down
11 changes: 6 additions & 5 deletions state/mapstate/migrate.go
Expand Up @@ -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
Expand Down

0 comments on commit 6c28d6b

Please sign in to comment.