sindresorhus/refined-github

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Feature Request: on an 404 with master try to redirect to main #3301

muescha posted onGitHub

When

  • a repo renames the default branch from master to main
  • GitHub has no default redirect :(
  • i open a deep link to a file at the master branch

Expected

  • redirect to master
  • or a default button to main without requesting the default branch

Current

  • i see an 404
  • i see the path and strike for dirs which are deleted
  • but i don't always see the try default branch button (maybe when it not possible to query for the default branch?)

https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-reference-like-url

Screenshot

<img width="1022" alt="Bildschirmfoto 2020-07-01 um 13 59 56" src="https://user-images.githubusercontent.com/184316/86241444-2ef39480-bba3-11ea-90a1-3bb03e7f3007.png">


We already show a link to the master branch

image

posted by yakov116 almost 5 years ago

We do check if the same file is available on the default branch. But that does not use the GH API, only basic public 404 validation.

Can you see if you have any errors in the browser console when the link doesn't show up.

posted by notlmn almost 5 years ago

@yakov116 looks like the user here is facing an issue where the default branch link doesn't show up as per the screenshot, even though that feature is enabled. Maybe something is happening while checking for the file on default branch.

posted by notlmn almost 5 years ago

Did not check it out. But maybe they have the default branch already in the cache. We do a 404 check before and on the cache default branch it does not exist.

posted by yakov116 almost 5 years ago

@yakov116 yup, looks like a cache issue.

@muescha can you try clearing your extension cache from inside the extension options page and trying this out again. Because as @yakov116 mentioned we do already show that link as you are expecting it.

posted by notlmn almost 5 years ago

but since the get renamed often, maybe if there is no cache hit, then retry to fetch from api?

posted by muescha almost 5 years ago

@muescha people rarely rename branches, but they do delete them often.

#3302 should reduce the amount of caching annoyances by some bit.

posted by notlmn almost 5 years ago

@muescha people rarely rename branches, but they do delete them often.

yes - but in case of missing the master branch but the repo is still there, then the chance it is renamed to main is very high.

#3302 should reduce the amount of caching annoyances by some bit.

i hope this helps

and i hope github do this redir by default ...

posted by muescha almost 5 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests