mirror of https://github.com/restic/restic.git
check: Also check blob length and offset
This commit is contained in:
parent
80dcfca191
commit
17bb77b1f9
|
@ -800,13 +800,13 @@ func checkPack(ctx context.Context, r restic.Repository, id restic.ID, size int6
|
||||||
// Check if blob is contained in index and position is correct
|
// Check if blob is contained in index and position is correct
|
||||||
idxHas := false
|
idxHas := false
|
||||||
for _, pb := range idx.Lookup(blob.ID, blob.Type) {
|
for _, pb := range idx.Lookup(blob.ID, blob.Type) {
|
||||||
if pb.PackID == id {
|
if pb.PackID == id && pb.Offset == blob.Offset && pb.Length == blob.Length {
|
||||||
idxHas = true
|
idxHas = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !idxHas {
|
if !idxHas {
|
||||||
errs = append(errs, errors.Errorf("Blob ID %v is not contained in index", blob.ID.Str()))
|
errs = append(errs, errors.Errorf("Blob %v is not contained in index or position is incorrect", blob.ID.Str()))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue