mirror of
https://github.com/restic/restic.git
synced 2024-12-23 00:07:25 +00:00
restorer: Sanitize verify errors
This commit is contained in:
parent
bdcdfaf6b4
commit
2cdc0719af
2 changed files with 5 additions and 1 deletions
|
@ -351,6 +351,9 @@ func (res *Restorer) VerifyFiles(ctx context.Context, dst string) (int, error) {
|
|||
for job := range work {
|
||||
buf, err = res.verifyFile(job.path, job.node, buf)
|
||||
if err != nil {
|
||||
err = res.Error(job.path, err)
|
||||
}
|
||||
if err != nil || ctx.Err() != nil {
|
||||
break
|
||||
}
|
||||
atomic.AddUint64(&nchecked, 1)
|
||||
|
|
|
@ -844,5 +844,6 @@ func TestVerifyCancel(t *testing.T) {
|
|||
nverified, err := res.VerifyFiles(ctx, tempdir)
|
||||
rtest.Equals(t, 0, nverified)
|
||||
rtest.Assert(t, err != nil, "nil error from VerifyFiles")
|
||||
rtest.Equals(t, []error(nil), errs)
|
||||
rtest.Equals(t, 1, len(errs))
|
||||
rtest.Assert(t, strings.Contains(errs[0].Error(), "Invalid file size for"), "wrong error %q", errs[0].Error())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue