Skip to content

fix: treat microlink.io content hosts as valid target URLs#116

Merged
Kikobeats merged 1 commit into
masterfrom
next
Jul 1, 2026
Merged

fix: treat microlink.io content hosts as valid target URLs#116
Kikobeats merged 1 commit into
masterfrom
next

Conversation

@Kikobeats

@Kikobeats Kikobeats commented Jul 1, 2026

Copy link
Copy Markdown
Member

Problem

microlink-dev 'https://cdn.microlink.io/file-examples/sample.docx&pdf=true&meta=false'
# FAIL: The `url` as `file-examples/sample.docx` is not valid (EINVALURLCLIENT)

The CLI stripped the cdn.microlink.io host as if it were an API endpoint, leaving an invalid bare path.

Cause

normalizeInput stripped any *.microlink.io host unconditionally, so a plain content URL (cdn, etc.) lost its host.

Fix

Host stripping now only runs for API-shaped input, which always carries a url= query. A bare target URL on a microlink.io content host has none, so it survives untouched. All existing normalization cases (API paste, endpoint stripping, port-prefix safety) are preserved; added tests for the content-host case.

🤖 Generated with Claude Code


Note

Low Risk
Small, test-backed change to CLI input normalization with no auth or data-path impact; existing API-paste cases remain covered by tests.

Overview
Fixes the CLI rejecting bare https://cdn.microlink.io/... targets because normalizeInput stripped any *.microlink.io host as if the paste were an API URL.

Host stripping (microlink API host + binary endpoint host) now runs only when the input is API-shaped—it contains a url= query ((?:^|[?&])url=). Plain target URLs, including microlink content hosts, stay unchanged; pasted api.microlink.io/?url=… behavior is unchanged.

Tests cover cdn.microlink.io with and without a dev endpoint and trailing &pdf=true-style flags.

Reviewed by Cursor Bugbot for commit c3db5ad. Bugbot is set up for automated code reviews on this repo. Configure here.

A URL like https://cdn.microlink.io/file-examples/sample.docx was having its
host stripped as if it were an API endpoint, leaving an invalid bare path
(file-examples/sample.docx → EINVALURLCLIENT).

Host stripping now only runs for API-shaped input, which always carries a
`url=` query. A bare target URL on a microlink.io content host (cdn, etc.) has
none, so it is left untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 28516181973

Warning

No base build found for commit 01eb051 on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 97.801%

Details

  • Patch coverage: 16 of 16 lines across 1 file are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 553
Covered Lines: 551
Line Coverage: 99.64%
Relevant Branches: 129
Covered Branches: 116
Branch Coverage: 89.92%
Branches in Coverage %: Yes
Coverage Strength: 4.94 hits per line

💛 - Coveralls

@Kikobeats Kikobeats merged commit 6544886 into master Jul 1, 2026
2 checks passed
@Kikobeats Kikobeats deleted the next branch July 1, 2026 12:10
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