-
Notifications
You must be signed in to change notification settings - Fork 48
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
Allow empty files to be uploaded. #25
Conversation
google/resumable_media/_upload.py
Outdated
@@ -817,7 +817,7 @@ def get_next_chunk(stream, chunk_size, total_bytes): | |||
raise ValueError(msg) | |||
|
|||
content_range = get_content_range(start_byte, end_byte, total_bytes) | |||
return start_byte, end_byte, payload, content_range | |||
return start_byte, max([end_byte, 0]), payload, content_range |
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.
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.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
In the process, also dropping `end_byte` as part of the returned values in `get_next_chunk()`. This is because the function only has one caller and that caller does not use the `end_byte`.
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 |
# stream to be at the beginning. | ||
if num_bytes_read != 0: | ||
raise ValueError( | ||
u'Stream specified as empty, but produced non-empty content.') |
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.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Merging based on a Hangouts LGTM from @lukesneeringer |
@dhermes I am not sure this is actually the correct fix for googleapis/google-cloud-python#3685, but it seems logical and in line with what the original reporter expected.
If this is the wrong answer, I would appreciate guidance on what the correct answer is.
Fixes googleapis/google-cloud-python#3685