镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Preserve URL fragments in OpenFile / Windows OpenURL - #67

Open
team-humaki wants to merge 1 commit into
pkg:masterfrom
team-humaki:fix-preserve-url-fragments
Open

team-humaki wants to merge 1 commit into
pkg:masterfrom
team-humaki:fix-preserve-url-fragments

Conversation

@team-humaki

Copy link
Copy Markdown

Fixes #59.

OpenFile ran filepath.Abs on the full string including #fragment, so the fragment was treated as part of the path. It also built file:// URLs without normalizing Windows paths.

This splits the fragment first, builds a proper file: URL via net/url (so C:\… becomes file:///C:/…#fragment), and on Windows uses rundll32 url.dll,FileProtocolHandler instead of ShellExecute, which drops fragments on file: URLs.

Split '#fragment' before filepath.Abs, build a proper file: URL, and
open via rundll32 FileProtocolHandler on Windows so fragments are kept.
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.

OpenFile and OpenURL both ignore URL fragments (#)

1 participant