plugin-update-checker icon indicating copy to clipboard operation
plugin-update-checker copied to clipboard

GitHubApi - Download Not Found - Case Sensitivity Bugfix

Open gfullen opened this issue 4 years ago • 1 comments

Spent the better bar of a 8 hour day trying to figure this out haha.

So when creating repositories in GitHub, you can provide a friendly name and a slug will be generated from that. The issue is that GitHub doesn't force the generated slug to lower case.

Therefore, when you're comparing the request url with the download url here https://github.com/YahnisElsts/plugin-update-checker/blob/master/Puc/v4p9/Vcs/GitHubApi.php#L405

it will fail the comparison and not attach the necessary access token. I changed that line to

if ($this->isAuthenticationEnabled() && (strpos(mb_strtolower($url), mb_strtolower($repoApiBaseUrl))) === 0) {

and it's working as expected. I tried to submit a pull request but I've never done on another project and it was asking me to authenticate. So I just decided to explain it here haha.

gfullen avatar Apr 11 '20 01:04 gfullen

I'm too lazy to create a new repository and a plugin to test this, but could you work around this issue by changing the slug in the repository URL that you provide to the update checker?

For example, if you're doing this:

$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'https://github.com/user-name/Repo-Name/',
	__FILE__
);

Try this instead:

$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'https://github.com/user-name/repo-name/',
	__FILE__
);

YahnisElsts avatar Apr 11 '20 10:04 YahnisElsts