mirror of https://github.com/restic/restic.git
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
|
@ -327,6 +327,11 @@ func (b *Backend) List(ctx context.Context, t restic.FileType, fn func(restic.Fi
|
||||||
return errors.Wrap(err, "List")
|
return errors.Wrap(err, "List")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
|
// ignore missing directories
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
return errors.Errorf("List failed, server response: %v (%v)", resp.Status, resp.StatusCode)
|
return errors.Errorf("List failed, server response: %v (%v)", resp.Status, resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue