Skip to content

feat(cli): assume a scheme for links that name none, as curl does - #625

Merged
linroid merged 1 commit into
mainfrom
feat/cli-assume-scheme
Oct 23, 2026
Merged

linroid merged 1 commit into
mainfrom
feat/cli-assume-scheme

Conversation

@linroid

@linroid linroid commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Found while testing CLI input:

ketch www.example.com/index.html
Download failed: No download source handles this link: www.example.com/index.html

curl and wget both accept a link without a scheme, and links copied from text or chat often lack one.

What changes

withAssumedScheme (used by ketch <url> and ketch add) adds the scheme curl assumes. It applies when the argument is a host holding a dot, or localhost, with an optional numeric port and followed by a path:

Argument Becomes
example.com/file.zip, example.com:8080/a, localhost:8765/a.bin http://… (servers redirect to HTTPS as they do for browsers)
ftp.gnu.org/gnu/hello-2.12.tar.gz ftp://…
https://…, magnet:?…, metalink:…, file:///… unchanged
an existing local file (my.dir/a.torrent) unchanged
ubuntu.torrent, downloads/ubuntu.torrent, example.com unchanged (a mistyped file name is refused as no link rather than looked up as a host)

host:port/path isn't mistaken for a scheme: a scheme is followed by //, or holds no dot and no port follows it (magnet:). The CLI's Downloading: line shows the link with its scheme.

Verification

  • ketch from this branch: localhost:8765/file/s.bin (HTTP), ftp.gnu.org/gnu/hello/hello-2.12.tar.gz (FTP) and github.com/linroid/Ketch/releases/download/v0.10.1/SHA256SUMS (redirected to HTTPS) all download.
  • New DownloadArgsTest cases for the table above, including parseDownloadArgs.
  • ./gradlew :cli:test --tests '*DownloadArgsTest*' --tests '*InstanceArgsTest*' passes.

`ketch example.com/file.zip` failed with "No download source handles this
link". As curl and wget, `ketch <url>` and `ketch add` now read a host
with a dot, or localhost, followed by a path as http:// (ftp:// for ftp.
hosts), which servers may redirect to HTTPS. Links with a scheme, local
files such as a .torrent, and bare names stay as they are.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T16:17:33.745418Z 455e16e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 23, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 455e16eaa8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 2 199 files  ±0   2 227 suites  ±0   55m 53s ⏱️ -58s
15 321 tests +2  15 053 ✅ +2  268 💤 ±0  0 ❌ ±0 
18 678 runs  +2  18 410 ✅ +2  268 💤 ±0  0 ❌ ±0 

Results for commit 455e16e. ± Comparison against base commit c7c6457.

@linroid
linroid merged commit 448c829 into main Oct 23, 2026
15 checks passed
@linroid
linroid deleted the feat/cli-assume-scheme branch October 23, 2026 17:33
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.

1 participant