refactor: simplify browser dialer parsed path normalization

Agent-Logs-Url: https://github.com/XTLS/Xray-core/sessions/56a85a3a-5e08-44ce-97d9-d441379c11cc

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-26 19:02:41 +00:00
committed by GitHub
parent e79f3a4361
commit 7416fd225e

View File

@@ -149,7 +149,10 @@ func parseBrowserDialerAddress(addr string) (string, string, bool) {
if _, _, err := net.SplitHostPort(listenAddr); err != nil {
return "", "", false
}
path := "/" + strings.Trim(strings.TrimSuffix(parsedAddr.Path, "/"), "/")
path := strings.TrimSuffix(parsedAddr.Path, "/")
if !strings.HasPrefix(path, "/") {
path = "/" + path
}
cleanPath := pathlib.Clean(path)
if cleanPath == "." || cleanPath == "/" || cleanPath != path {
return "", "", false