fix(common): Handle downloads from sources that don’t provide a "Content-Length" header#3045
Open
kbatalin wants to merge 1 commit intosoimort:developfrom
Open
fix(common): Handle downloads from sources that don’t provide a "Content-Length" header#3045kbatalin wants to merge 1 commit intosoimort:developfrom
kbatalin wants to merge 1 commit intosoimort:developfrom
Conversation
…ent-Length" header In some cases, sources do not return the Content-Length header. This can happen due to a proxy or simply because the source does not include it by design. Currently, you-get either: - Attempts to download the next range with an invalid Range header (out of bounds), resulting in an HTTP error, or - Gets stuck in an infinite loop of attempts. This PR fixes the issue by adjusting the exit condition: If the expected file size is infinite (i.e., undetermined) and the buffer has been fully read, the loop exits successfully. Additionally, this PR includes other fixes to ensure proper functionality: - Correctly processes URLs when provided as a list with a single element. - Prevents deleting the temporary file in this case, as it is actually the final result, not a temporary file. A test has been added to reproduce and verify the issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some cases, sources do not return the Content-Length header. This can happen due to a proxy or simply because the source does not include it by design.
Currently,
you-geteither:This PR fixes the issue by adjusting the exit condition: If the expected file size is infinite (i.e., undetermined) and the buffer has been fully read, the loop exits successfully.
Additionally, this PR includes other fixes to ensure proper functionality:
A test has been added to reproduce and verify the issue.