Skip to content

download() > Accept: application/zip for ZIP files - #834

Merged
mmathieum merged 3 commits into
masterfrom
mm/download_curl_header_zip
Jul 31, 2026
Merged

download() > Accept: application/zip for ZIP files#834
mmathieum merged 3 commits into
masterfrom
mm/download_curl_header_zip

Conversation

@mmathieum

Copy link
Copy Markdown
Member

No description provided.

@mmathieum mmathieum self-assigned this Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mmathieum, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 12 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5d9d53ea-5577-4589-b95f-767d91a3528f

📥 Commits

Reviewing files that changed from the base of the PR and between 1c6c769 and 236ed31.

📒 Files selected for processing (1)
  • commons.sh
📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved download compatibility by explicitly requesting ZIP archives for all cURL-based downloads.
    • Preserved existing WGET behavior and fallback handling.

Walkthrough

commons.sh now sends Accept: application/zip with every CURL download request, including conditional downloads, retries, and custom OpenSSL fallbacks. WGET behavior and fallback control flow remain unchanged.

Changes

CURL download header propagation

Layer / File(s) Summary
Propagate ZIP Accept header across CURL paths
commons.sh
All conditional, non-conditional, insecure retry, and custom OpenSSL CURL requests now include Accept: application/zip. WGET behavior and fallback control flow remain unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided, so it does not give meaningful context about the change. Add a brief description that explains the Accept: application/zip change and its effect on CURL downloads.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: adding the Accept: application/zip header to download() requests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mm/download_curl_header_zip

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@commons.sh`:
- Line 445: Change CURL_HEADERS from a single string to a shell array containing
separate -H and header arguments, then update all six curl call sites to expand
it with "${CURL_HEADERS[@]}" so each argument is passed separately.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ff9dba3-2f9a-4c2d-ae1e-23f54d5696b0

📥 Commits

Reviewing files that changed from the base of the PR and between 7bb5242 and 1c6c769.

📒 Files selected for processing (1)
  • commons.sh

Comment thread commons.sh Outdated
@mmathieum mmathieum changed the title Shell scrips > download > Accept: application/zip download() > Accept: application/zip for ZIP files Jul 31, 2026
@mmathieum
mmathieum requested a review from Copilot July 31, 2026 13:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the shared download() helper in commons.sh to send an explicit Accept: application/zip header when downloading ZIP artifacts, improving server-side content negotiation for ZIP endpoints.

Changes:

  • Add conditional request headers for CURL when the downloaded file is a .zip.
  • Thread the new header list through all CURL download paths (normal, insecure, and legacy renegotiation).
Suppressed comments (2)

commons.sh:455

  • The new ZIP Accept header is only applied to CURL. If CURL fails and this function falls back to WGET (a few lines below), the WGET request won’t include the header, so ZIP endpoints that require this header may still fail in the fallback path.
		$CURL_ "${CURL_HEADERS[@]}" --user-agent "$USER_AGENT" --location --output "${NEW_FILE}" --time-cond "${LAST_FILE}" --max-time "$TIMEOUT_SEC" --retry 3 "$URL";

commons.sh:486

  • Same issue in the no-last-file path: the WGET fallback (below) doesn’t include the ZIP Accept header, so behavior diverges from CURL and may still fail for ZIP endpoints that require it.
			$CURL_ "${CURL_HEADERS[@]}" --insecure --user-agent "$USER_AGENT" --location --output "${NEW_FILE}" --max-time "$TIMEOUT_SEC" --retry 3 "$URL";

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread commons.sh
@mmathieum
mmathieum merged commit 350d4a6 into master Jul 31, 2026
5 checks passed
@mmathieum
mmathieum deleted the mm/download_curl_header_zip branch July 31, 2026 13:45
mmathieum added a commit to mtransitapps/ca-moose-jaw-transit-bus-android that referenced this pull request Jul 31, 2026
…er':

- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons: Add initial .pr_agent.toml configuration file
- commons: Add Qodo config to `.pr_agent.toml` mtransitapps/commons#833
- commons-android: `Schedule.Timestamp` KT ext mtransitapps/commons-android#191
- commons-android: Add initial .pr_agent.toml configuration file
- commons-java: Add initial .pr_agent.toml configuration file
- parser: Add initial .pr_agent.toml configuration file
montransit added a commit to mtransitapps/mtransit-for-android that referenced this pull request Jul 31, 2026
mmathieum added a commit to mtransitapps/fr-haute-garonne-lio-bus-android that referenced this pull request Jul 31, 2026
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
montransit added a commit to mtransitapps/ca-st-hyacinthe-transport-collectif-bus-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
montransit added a commit to mtransitapps/ca-ottawa-oc-transpo-bus-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
montransit added a commit to mtransitapps/ca-mrc-nicolet-yamaska-bili-bus-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
montransit added a commit to mtransitapps/ca-ottawa-oc-transpo-train-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants