-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Strange results for download_blob with offset and length #7061
Comments
One more data point. I decided to try reading past the single byte that was returned in the second case, and in that case get an exception:
For reference the file is 72 bytes:
|
Hi @bryevdv For the weird behavior of download_blob, that is because the name of parameter length is not accurate.. the parameter name should be something like range_end instead of length. Also for stage_block_from_url API, the length also means range_end (in case you also use that) Sorry about the inconvenience again. |
@xiafu-msft I might suggest keeping the public parameter as length, and instead internally computing the range end from it. From a user perspective I expect it is more common and convenient to want to say "download 500 bytes starting at byte 500" than it is to say "download bytes between 500 and 999" FYI in python it is consistenty the case that ranges are half open, inclusive of the start, but exclusive of the end. If you do keep an API that specifies the "end" instead of a length, it would definitely be advised to make the end behave the same way as ranges everywhere else in Python. |
fixed |
Seeing the following results with azure.storage.blob version 12.0.0b2
Noting the following unexpected behavior:
offset=0, length=5
returnsb'class '
which has length 6offset=5, length=5
only returns one byte even though there are more than 5 bytes left in the file at that offsetAlso there is a typo in the ValueError raised when a length is given without an offset:
I think that is meant to be "IF length is set" (or perhaps "when length is set")
cc @annatisch @rakshith91 @xiafu-msft @zezha-msft
The text was updated successfully, but these errors were encountered: