question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GitHub bug: "Go to file" leads to encoded URL

See original GitHub issue

Please ensure:

  • The bug is caused by Refined GitHub. It doesn’t happen if I disable the extension.
  • The bug happens after clearing extension cache. The “Clear cache” button below can also be found at the bottom of the options page.

Example URLs

https://github.com/refined-github/refined-github/find/main

Extension version

22.3.3

Browser(s) used

Chrome

Description

Not actually RGH bug, but affects RGH.

The native “Go to file” feature now leads to URL encoded file paths, prevent some features like rgh-feature-descriptions to work.

// https://github.githubassets.com/assets/app/assets/modules/github/repositories/tree-finder.ts
virtualList.addEventListener('virtual-list-render-item', (event: Event) => {
    if (!(event instanceof CustomEvent)) return
    const frag = new TemplateInstance(template, {
      item: event.detail.item,
      id: `entry-${Math.random().toString().substr(2, 5)}`,
      urlEncodedItem: encodeURIComponent(event.detail.item)
    })
    const marker = frag.querySelector<MarkedTextElement>('marked-text')
    if (marker) marker.positions = positions
    event.detail.fragment.append(frag)
  })

Maybe we can add a feature to “normalize” these paths, could even bring https://github.com/refined-github/refined-github/issues/5326#issuecomment-1018560216 in.

Implementation I can think of: create a hidden PJAX link that links to the normalized path, then click it to trigger PJAX navigation (or probably just do a hard refresh?).

Include in this issue:

  • Screenshots/video/gif demonstrating the bug, if it’s visual
  • Console errors, if any

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
SuperSandro2000commented, Mar 8, 2022

This would be really great to have. I often copy the paths from the GitHub URL and needing to HTML decode them first is a pain.

2reactions
kidonngcommented, Mar 18, 2022

Seems like GitHub resolved this by replacing encodeURIComponent() with this:

// Encode list item for URL accounting for '/' for items that are paths
function urlEncodeItem(itemName: string) {
  return encodeURIComponent(itemName).replaceAll('%2F', '/')
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

url-encoded query causing unexpected behaviour #1392
Hi, I was trying to use the search-issues API. So, I was running below query directly from chrome: ...
Read more >
File URL reparse bug with percent encoded windows drive letter
There is a reparse bug, when parsing URL with percent encoded windows drive letter ( C| ) in the host. URLs to test:...
Read more >
wiki: URL encoding bug · Issue #4090 · go-gitea/gitea - GitHub
Since #4058, the links are no longer encoded. But the URLs(files name) of the existing pages or new pages are still encoded.
Read more >
Invalid URL: file path occasionally converted to URL · Issue #35
Describe the bug. Occasionally the absolute file path passed to decode-config is converted to a URL. /tmp/tasmota01.local.dmp => http:///tmp/ ...
Read more >
Config file path contains url encoded slash on windows when ...
For some reason probot seems to be encoding the slash between .github and .config . I've checked the code and it seems that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found