URLs for code links are escaping `+`s found in file paths
What is the problem?
On the results page, if a search result contains a + in the file path, e.g. filename is SwiftFileName+SwiftCategoryName.swift, the URL escapes the + such that it breaks the link.
E.g. if the search result is expected to point to https://github.com/OrganizationName/RepositoryName/path/to/SwiftFileName+SwiftCategoryName.swift, the URL becomes https://github.com/OrganizationName/RepositoryName/path/to/SwiftFileName+SwiftCategoryName.swift, which leads to a broken page.
Why is this a problem?
- Poor user experience while navigating results
- The
+should not be escaped, it's just wrong
Proposed fix
- Prevent
+from being escaped in result URLs. There might be other symbols getting problematically escaped, but I have not encountered these yet
Thanks for the report, should be an easy fix.
Awesome, thank you!
Briefly looked into it, gets deeper into the weeds with https://github.com/golang/go/issues/42506
- html/template escapes
+to#43The template is executed here: https://github.com/sourcegraph/zoekt/blob/main/web/snippets.go#L79
I thought this would be easy to solve, but it ended up being a pretty deep change. Hopefully https://github.com/sourcegraph/zoekt/pull/843 resolves this for you.