Skip to content

Commit

Permalink
APPS-1469 Fix azure ListObjects method (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
filkeith authored Jan 22, 2025
1 parent 590d729 commit b7fb429
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/internal/app/asbackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ func (a *ASBackupParams) isUnblockMRT() bool {
return a.BackupXDRParams != nil && a.BackupXDRParams.UnblockMRT
}

func (a *ASBackupParams) SkipWriterInit() bool {
if a.BackupParams != nil {
return !a.BackupParams.Estimate
}

return true
}

func NewASBackup(
ctx context.Context,
params *ASBackupParams,
Expand All @@ -92,7 +100,7 @@ func NewASBackup(

// We don't need writer for estimates.
var writer backup.Writer
if !params.BackupParams.Estimate {
if params.SkipWriterInit() {
writer, err = initializeBackupWriter(ctx, params, secretAgent)
if err != nil {
return nil, err
Expand Down
4 changes: 4 additions & 0 deletions io/azure/blob/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ func (r *Reader) checkRestoreDirectory(ctx context.Context, path string) error {

// ListObjects list all object in the path.
func (r *Reader) ListObjects(ctx context.Context, path string) ([]string, error) {
if !strings.HasSuffix(path, "/") {
path += "/"
}

result := make([]string, 0)

pager := r.client.NewListBlobsFlatPager(r.containerName, &azblob.ListBlobsFlatOptions{
Expand Down
4 changes: 4 additions & 0 deletions io/gcp/storage/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ func (r *Reader) checkRestoreDirectory(ctx context.Context, path string) error {

// ListObjects list all object in the path.
func (r *Reader) ListObjects(ctx context.Context, path string) ([]string, error) {
if !strings.HasSuffix(path, "/") {
path += "/"
}

result := make([]string, 0)

it := r.bucketHandle.Objects(ctx, &storage.Query{
Expand Down

0 comments on commit b7fb429

Please sign in to comment.