Skip to content

Commit da31d7c

Browse files
committed
handle more heavily mangled keys
1 parent ba93f55 commit da31d7c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,6 @@ func transferBlocks(flatfsdir string) error {
333333
}
334334

335335
rel := p[len(flatfsdir)+1:]
336-
if !strings.HasPrefix(rel, "1220") {
337-
fmt.Println("skipping: ", rel)
338-
return nil
339-
}
340-
341336
if !strings.HasSuffix(rel, ".data") {
342337
fmt.Println("skipping (no .data): ", rel)
343338
return nil
@@ -352,6 +347,12 @@ func transferBlocks(flatfsdir string) error {
352347
prog.Next()
353348
rel := p[len(flatfsdir)+1:]
354349

350+
justkey := rel[:len(rel)-5]
351+
if validateNewKey(justkey) {
352+
prog.Skip()
353+
fmt.Printf("skipping %s, already in new format\n", justkey)
354+
}
355+
355356
_, fi := filepath.Split(rel[:len(rel)-5])
356357
k, err := hex.DecodeString(fi)
357358
if err != nil {

sharness/t0080-three-to-four.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ test_expect_success "add some files with the path clean bug" '
8383
printf cdbd | ipfs add -q >> buggy_hashes &&
8484
printf aabdb | ipfs add -q >> buggy_hashes &&
8585
printf bccac | ipfs add -q >> buggy_hashes &&
86+
echo 0243397916 | ipfs add -q >> buggy_hashes && # produces /../ in binary key
8687
sort buggy_hashes -o buggy_hashes
8788
8889
'

0 commit comments

Comments
 (0)