Skip to content

Commit 1e510aa

Browse files
committed
fix handling of new keys
1 parent 7fa7dfc commit 1e510aa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ipfs-3-to-4/migration/migration.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ type txFunc func(dstore.Datastore, dstore.Key, []byte, mkKeyFunc) error
4343

4444
func validateNewKey(s string) bool {
4545
parts := strings.Split(s, "/")
46-
if len(parts) < 3 {
47-
return false
48-
}
4946

50-
kpart := s[2+len(parts[1]):]
47+
kpart := parts[len(parts)-1]
5148
v, err := base32.RawStdEncoding.DecodeString(kpart)
5249
if err == nil && len(v) == 34 {
5350
return true
@@ -368,6 +365,7 @@ func transferBlocks(flatfsdir string) error {
368365
if validateNewKey(justkey) {
369366
prog.Skip()
370367
fmt.Printf("skipping %s, already in new format\n", justkey)
368+
continue
371369
}
372370

373371
_, fi := filepath.Split(rel[:len(rel)-5])

0 commit comments

Comments
 (0)