mirror of
				https://github.com/restic/restic.git
				synced 2025-11-04 03:56:52 +00:00 
			
		
		
		
	restorer: Sanitize verify errors
This commit is contained in:
		@@ -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())
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user