Skip to content

URL-encode path segments to fix pound sign in filenames#242

Merged
patrickdappollonio merged 2 commits intomasterfrom
fix-pound-url-encoding
Mar 23, 2026
Merged

URL-encode path segments to fix pound sign in filenames#242
patrickdappollonio merged 2 commits intomasterfrom
fix-pound-url-encoding

Conversation

@patrickdappollonio
Copy link
Copy Markdown
Owner

Summary

  • Fixes # Not Url Encoded #234 — filenames containing # were not URL-encoded, causing the browser to treat everything after # as a fragment identifier instead of part of the file path.
  • CanonicalURL now URL-encodes each path segment individually using url.PathEscape, so # becomes %23, spaces become %20, etc.
  • Adds table-driven tests for CanonicalURL covering #, spaces, ?, %, and other special characters.

Test plan

  • go test ./internal/common/ passes (12 test cases)

…inks

Fixes #234 -- filenames containing '#' were not URL-encoded, causing
the browser to interpret everything after '#' as a fragment identifier
instead of part of the path. Each path segment is now individually
escaped using url.PathEscape.
@patrickdappollonio patrickdappollonio merged commit 23cff43 into master Mar 23, 2026
2 checks passed
@patrickdappollonio patrickdappollonio deleted the fix-pound-url-encoding branch March 23, 2026 04:01
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.

# Not Url Encoded

1 participant