mirror of
https://github.com/restic/restic.git
synced 2024-12-24 00:37:28 +00:00
rest: Don't return error if listing non-existent directory
When transferring a repository from S3 to, for example, a local disk then all empty folders will be missing. When saving files, the missing intermediate folders are created automatically. Therefore, missing directories can be ignored by the `List()` operation.
This commit is contained in:
parent
9cd85d5956
commit
307aeb6849
1 changed files with 5 additions and 0 deletions
|
@ -327,6 +327,11 @@ func (b *Backend) List(ctx context.Context, t restic.FileType, fn func(restic.Fi
|
|||
return errors.Wrap(err, "List")
|
||||
}
|
||||
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
// ignore missing directories
|
||||
return nil
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return errors.Errorf("List failed, server response: %v (%v)", resp.Status, resp.StatusCode)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue