Repository navigation
Conversation
pawank925
marked this pull request as draft
October 22, 2026 17:11
save_large_file only accepted a user_agent parameter, so callers could not set other headers, and unlike stream_file it did not send the Wikimedia-compliant default User-Agent for upload.wikimedia.org. Accept arbitrary headers, merge them with the existing user_agent, and fall back to the default User-Agent for Wikimedia upload URLs when none is set. Closes openzim#360
pawank925
force-pushed
the
issue-360-save-large-file-headers
branch
from
October 22, 2026 17:12
be0cc45 to
6b90e66
Compare
pawank925
marked this pull request as ready for review
October 22, 2026 17:13
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #362 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 42 42
Lines 2855 2863 +8
Branches 428 430 +2
=========================================
+ Hits 2855 2863 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@benoit74 sorry for not asking assignment before the pr |
This branch has not been deployed
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.
changes
save_large_fileonly exposed auser_agentparameter, so callers could not set any other header, and unlikestream_fileit did not send the Wikimedia-compliant defaultUser-Agentwhen downloading fromupload.wikimedia.org.This adds a
headersparameter for arbitrary HTTP headers and reuses the existingis_wikimedia_upload_url/has_user_agent_headerhelpers, sosave_large_filebehaves likestream_file:headersare sent with every request (including resumed ones, alongside theRangeheader);user_agent, when set, still wins over aUser-Agententry inheaders;upload.wikimedia.org, the default Wikimedia-compliantUser-Agentis sent unless aUser-Agentis already set throughuser_agentorheaders.Added unit tests covering arbitrary headers, the Wikimedia default, and precedence between
user_agentand aUser-Agentheader; the full download test module passes (49 passed, 16 skipped, slow tests excluded).ruffandblackare clean.CHANGELOG.mdupdated.Closes #360