diff --git a/cmd/internal/app/asbackup.go b/cmd/internal/app/asbackup.go index 82f3433c..777f6ede 100644 --- a/cmd/internal/app/asbackup.go +++ b/cmd/internal/app/asbackup.go @@ -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, @@ -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 diff --git a/io/azure/blob/reader.go b/io/azure/blob/reader.go index ed5279c6..92f7a769 100644 --- a/io/azure/blob/reader.go +++ b/io/azure/blob/reader.go @@ -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{ diff --git a/io/gcp/storage/reader.go b/io/gcp/storage/reader.go index 17a254a3..88f3393d 100644 --- a/io/gcp/storage/reader.go +++ b/io/gcp/storage/reader.go @@ -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{