Skip to content

fix: allow file:// URLs with --url option#754

Merged
skjnldsv merged 3 commits into
masterfrom
fix/file-url-download
May 13, 2026
Merged

fix: allow file:// URLs with --url option#754
skjnldsv merged 3 commits into
masterfrom
fix/file-url-download

Conversation

@skjnldsv
Copy link
Copy Markdown
Member

What

CURLINFO_HTTP_CODE returns 0 for file:// URLs (curl handles them directly, no HTTP involved). The download step checked $httpCode !== 200 && $httpCode !== 206, so it always treated a successful local file copy as a failure and reported "All downloads failed."

Fix: skip the HTTP code check when the URL scheme is file://.

Affects both lib/Updater.php (CLI) and index.php (web updater).

Why

Useful for testing upgrades offline or in air-gapped environments where the archive is already present on the server.

Usage:

php updater.phar --url file:///path/to/nextcloud-x.x.x.zip --no-verify

Note: --no-verify or --signature is still required when using --url (unchanged behaviour — the error message already explains this).

Tests

Two new Behat scenarios in tests/features/cli.feature:

  • Update via local file URL with --no-verify — verifies the full upgrade succeeds
  • Update via local file URL without --no-verify fails — verifies the existing signature-required error is still raised

Steps to reproduce (before fix)

php updater.phar --url file:///tmp/nextcloud-32.0.1.zip --no-verify
# → [✘] Downloading failed — All downloads failed.

@skjnldsv skjnldsv requested a review from Altahrim as a code owner May 13, 2026 13:57
@skjnldsv skjnldsv force-pushed the fix/file-url-download branch 3 times, most recently from c8a13aa to edcd021 Compare May 13, 2026 14:28
@Altahrim Altahrim force-pushed the fix/file-url-download branch from edcd021 to 76906d6 Compare May 13, 2026 14:34
Comment thread lib/Updater.php Outdated
skjnldsv and others added 2 commits May 13, 2026 16:43
curl returns HTTP code 0 for file:// (no HTTP involved), causing the
download step to incorrectly treat a successful local file copy as a
failure. Skip the HTTP code check when the URL uses the file:// scheme.

Add Behat scenarios covering the happy path (--no-verify) and the
missing-signature error for local file URLs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv force-pushed the fix/file-url-download branch from 76906d6 to aee05a4 Compare May 13, 2026 14:44
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@Altahrim Altahrim force-pushed the fix/file-url-download branch from aee05a4 to 469a801 Compare May 13, 2026 14:51
@skjnldsv skjnldsv enabled auto-merge May 13, 2026 14:57
@skjnldsv skjnldsv requested a review from blizzz May 13, 2026 15:05
@skjnldsv skjnldsv merged commit 3972023 into master May 13, 2026
21 checks passed
@skjnldsv skjnldsv deleted the fix/file-url-download branch May 13, 2026 15:07
@skjnldsv
Copy link
Copy Markdown
Member Author

Docs nextcloud/documentation#14846

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants