-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Catch checksum validation failure from download, delete corrupt file #4133
Conversation
Needs a new unit test for the case where the |
@tseaver - there's an integration test for this case |
@mfschwartz We require 100% unit test coverage: see the current CI failure. Note the linter failures in that output as well. |
@tseaver @mfschwartz I'm happy to take up the testing mantle. Before this can go in I need to get an LGTM on googleapis/google-resumable-media-python#33 and cut a release there. |
…google-resumable-media-python library and delete corrupt file
This is the only method where we **know** we have created the file, so it is safe to delete it. In `download_to_file`, the user could pass in a non-file but file-like object, so there would be nothing to delete. Also - Adding a unit test for corrupted data - Just calling `raise` rather than re-wrapping the exception. Using `exceptions.from_http_response` or `exceptions.from_http_status` wouldn't make sense because the corruption will have happened with a status of 200 or 206.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
except resumable_media.DataCorruption as exc: | ||
# Delete the corrupt downloaded file. | ||
os.remove(filename) | ||
raise |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@mfschwartz RE:
He (Tres) was referring to tests in this library, not in |
@jonparrott @lukesneeringer @tseaver Can I get an LGTM? |
Since @tseaver has made a lot of I made one branch just by starting from the I made another branch from Both approaches will make figuring out what has changed for the next release difficult. It will at least be difficult via So the question I put to @lukesneeringer and @jonparrott, is it worth it to cherry-pick this? The question I put to @tseaver, could we just release the |
This change depends on googleapis/google-resumable-media-python#31