archiver: fix file type change test

The test did not test the case that the type of a file changed
unexpectedly.
This commit is contained in:
Michael Eischer
2024-11-15 21:21:04 +01:00
parent d7f4b9db60
commit 6cb19e0190
2 changed files with 66 additions and 35 deletions

View File

@@ -369,7 +369,7 @@ func (arch *Archiver) dirToNodeAndEntries(snPath, dir string, meta fs.File) (nod
return nil, nil, err
}
if node.Type != restic.NodeTypeDir {
return nil, nil, fmt.Errorf("directory %v changed type, refusing to archive", snPath)
return nil, nil, fmt.Errorf("directory %q changed type, refusing to archive", snPath)
}
names, err = meta.Readdirnames(-1)
@@ -548,7 +548,7 @@ func (arch *Archiver) save(ctx context.Context, snPath, target string, previous
// make sure it's still a file
if !fi.Mode().IsRegular() {
err = errors.Errorf("file %v changed type, refusing to archive", target)
err = errors.Errorf("file %q changed type, refusing to archive", target)
return filterError(err)
}