Refined-github: Feature Request: on an 404 with master try to redirect to main

Created on 1 Jul 2020  路  10Comments  路  Source: sindresorhus/refined-github

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?)

Example Link

Link:

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

Screenshot

Bildschirmfoto 2020-07-01 um 13 59 56

bug

Most helpful comment

@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.

All 10 comments

We already show a link to the master branch

image

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.

@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.

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.

@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.

@notlmn clear cache worked, it show up the link again

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

@muescha people rarely _rename_ branches, but they do _delete_ them often.

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

@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 ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Celthi picture Celthi  路  3Comments

juliocanares picture juliocanares  路  3Comments

sompylasar picture sompylasar  路  3Comments

MilesBHuff picture MilesBHuff  路  3Comments

alexanderadam picture alexanderadam  路  3Comments