Skip to content

Commit

Permalink
respecting ignoredPath
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Protasio <approtas@amazon.com>
  • Loading branch information
alanprot committed Jul 5, 2022
1 parent b83620b commit 09b9955
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/objstore/objstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"path"
"path/filepath"
"strings"
"sync"
"time"

"github.com/go-kit/log"
Expand Down Expand Up @@ -263,13 +264,17 @@ func DownloadDir(ctx context.Context, logger log.Logger, bkt BucketReader, origi
g, ctx := errgroup.WithContext(ctx)

var downloadedFiles []string
var m sync.Mutex

err := bkt.Iter(ctx, src, func(name string) error {
g.Go(func() error {
dst := filepath.Join(dst, filepath.Base(name))
if strings.HasSuffix(name, DirDelim) {
if err := DownloadDir(ctx, logger, bkt, originalSrc, name, dst, ignoredPaths...); err != nil {
return err
}
m.Lock()
defer m.Unlock()
downloadedFiles = append(downloadedFiles, dst)
return nil
}
Expand All @@ -279,7 +284,15 @@ func DownloadDir(ctx context.Context, logger log.Logger, bkt BucketReader, origi
return nil
}
}
return DownloadFile(ctx, logger, bkt, name, dst)
if err := DownloadFile(ctx, logger, bkt, name, dst); err != nil {
return err
}

m.Lock()
defer m.Unlock()
downloadedFiles = append(downloadedFiles, dst)

return nil
})
downloadedFiles = append(downloadedFiles, dst)
return nil
Expand Down

0 comments on commit 09b9955

Please sign in to comment.