forked from TrueCloudLab/restic
local/sftp: Handling non-existing dirs in List()
This commit is contained in:
parent
6a34e0d10f
commit
577faa7570
2 changed files with 12 additions and 1 deletions
|
@ -235,7 +235,7 @@ func (b *Local) List(ctx context.Context, t restic.FileType, fn func(restic.File
|
|||
debug.Log("List %v", t)
|
||||
|
||||
basedir, subdirs := b.Basedir(t)
|
||||
return fs.Walk(basedir, func(path string, fi os.FileInfo, err error) error {
|
||||
err := fs.Walk(basedir, func(path string, fi os.FileInfo, err error) error {
|
||||
debug.Log("walk on %v\n", path)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -271,6 +271,13 @@ func (b *Local) List(ctx context.Context, t restic.FileType, fn func(restic.File
|
|||
|
||||
return ctx.Err()
|
||||
})
|
||||
|
||||
if b.IsNotExist(err) {
|
||||
debug.Log("ignoring non-existing directory")
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Delete removes the repository and all files.
|
||||
|
|
|
@ -425,6 +425,10 @@ func (r *SFTP) List(ctx context.Context, t restic.FileType, fn func(restic.FileI
|
|||
walker := r.c.Walk(basedir)
|
||||
for walker.Step() {
|
||||
if walker.Err() != nil {
|
||||
if r.IsNotExist(walker.Err()) {
|
||||
debug.Log("ignoring non-existing directory")
|
||||
return nil
|
||||
}
|
||||
return walker.Err()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue