Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(storage/transfermanager): DownloadDirectory fails if file already exists #10507

Merged
merged 5 commits into from
Jul 8, 2024

Conversation

BrennaEpp
Copy link
Contributor

@BrennaEpp BrennaEpp commented Jul 3, 2024

  • Also adds cleanup on error.

@BrennaEpp BrennaEpp requested review from a team as code owners July 3, 2024 23:59
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 3, 2024
@BrennaEpp BrennaEpp requested a review from tritone July 4, 2024 00:13
return fmt.Errorf("transfermanager: DownloadDirectory failed to make directory(%q): %w", objDirectory, err)
}

// Check if the file exists.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should just stat everything first in a loop before creating any files, assuming the user doesn't want SkipIfExists behavior? That way we would avoid having to do any cleanup steps. And in general I would expect that, if files already exist, it will be a mistake in terms of the provided path and so we'll encounter the issue fairly quickly.

Copy link
Contributor Author

@BrennaEpp BrennaEpp Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It helps us avoid clean up steps unless there are failures in directory or file creation. I went ahead and made that change.

@BrennaEpp BrennaEpp enabled auto-merge (squash) July 8, 2024 22:28
@BrennaEpp BrennaEpp merged commit 09a467d into googleapis:main Jul 8, 2024
8 checks passed
@BrennaEpp BrennaEpp deleted the tm-fail branch July 9, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants