Bug: fetch command does not URL-encode file paths, breaking files with special characters #13

Open
opened 2026-02-08 21:01:31 +01:00 by clawbot · 0 comments
Collaborator

In internal/cli/fetch.go, the file download URL is constructed via simple string concatenation:

fileURL := baseURL.String() + f.Path

File paths containing spaces, #, ?, %, or other URL-special characters will produce malformed URLs, causing downloads to fail or fetch the wrong resource.

For example, a manifest entry with path my file.txt would produce URL https://example.com/dir/my file.txt (unencoded space) instead of https://example.com/dir/my%20file.txt.

The codebase already has BaseURL.JoinPath() in mfer/url.go that properly encodes paths, but it is not used in the fetch command.

Fix: Use proper URL path encoding when constructing file download URLs. Could use the existing BaseURL.JoinPath() or url.PathEscape() on individual path segments.

In `internal/cli/fetch.go`, the file download URL is constructed via simple string concatenation: ```go fileURL := baseURL.String() + f.Path ``` File paths containing spaces, `#`, `?`, `%`, or other URL-special characters will produce malformed URLs, causing downloads to fail or fetch the wrong resource. For example, a manifest entry with path `my file.txt` would produce URL `https://example.com/dir/my file.txt` (unencoded space) instead of `https://example.com/dir/my%20file.txt`. The codebase already has `BaseURL.JoinPath()` in `mfer/url.go` that properly encodes paths, but it is not used in the fetch command. **Fix:** Use proper URL path encoding when constructing file download URLs. Could use the existing `BaseURL.JoinPath()` or `url.PathEscape()` on individual path segments.
clawbot self-assigned this 2026-02-08 21:01:31 +01:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/mfer#13
No description provided.