Merge pull request #1828 from restic/handle-s3-list-errors

s3: Pass list errors up to the caller
This commit is contained in:
Alexander Neumann 2018-06-02 10:34:49 +02:00
commit cfc19b4582

View file

@ -188,6 +188,10 @@ func (be *Backend) ReadDir(dir string) (list []os.FileInfo, err error) {
defer close(done)
for obj := range be.client.ListObjects(be.cfg.Bucket, dir, false, done) {
if obj.Err != nil {
return nil, err
}
if obj.Key == "" {
continue
}
@ -424,6 +428,10 @@ func (be *Backend) List(ctx context.Context, t restic.FileType, fn func(restic.F
listresp := be.client.ListObjects(be.cfg.Bucket, prefix, recursive, ctx.Done())
for obj := range listresp {
if obj.Err != nil {
return obj.Err
}
m := strings.TrimPrefix(obj.Key, prefix)
if m == "" {
continue