2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 04:45:15 +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:
Michael Eischer 2023-07-07 22:42:39 +02:00
parent 9cd85d5956
commit 307aeb6849

View File

@ -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)
}