sindresorhus/refined-github

`default-branch-button` creates incorrect URL if non-default branch has forward slash in name #4473

msfjarvis posted onGitHub

Going to https://github.com/anggrayudi/SimpleStorage/tree/release/0.8.0 page, the default branch button sets its URL to https://github.com/anggrayudi/SimpleStorage///0.8.0 which results in a 404.


Looks like getCurrentCommittish is failing.

It should be able to detect that.

posted by yakov116 almost 4 years ago

I've pushed a failing test here, if it's any help.

posted by msfjarvis almost 4 years ago

Thank you. Unfortunately branch with slashes are not detectable from the URL alone so that test can never pass.

What we do is look for other cues on the page itself to determine the branch name. Most pages have them. Yakov is referring to the function that looks for these cues.

posted by fregante almost 4 years ago

This line is failing, since it has a slash in it. (The '.' looks like an issue too) https://github.com/sindresorhus/refined-github/blob/80150ef192d4caa7f17cfd66e5186b79e8413d3f/source/github-helpers/index.ts#L20

posted by yakov116 almost 4 years ago

Fund this Issue

$0.00
Funded

Pull requests