thieman / github-selfies

Everything is better with selfies. Yes, even pull requests. Trust me.
MIT License
1.14k stars 76 forks source link

Make the allowed paths less strict #94

Closed haacked closed 5 years ago

haacked commented 5 years ago

The current regex is too strict with regards to username and repository name. For example, the selfie button does not show up for https://github.com/github/scientist.net/issues/new because of the . in scientist.net. Also, the regex would try to match sites such as "foogithub.com". Since GitHub requires https and the browser redirects URLs with backslashes to those with forward slashes, it's safe to simplify the regex as I've done here and include the https:// portion in the regex.

haacked commented 5 years ago

This fixes #88. There's another PR #89 that also fixes #88. Either one will work. I think the expressions in this PR are a little easier to follow as they take advantage of some more knowledge of how GitHub URLs work. However, either PR will fix the issue.

thieman commented 5 years ago

Going to merge this and try to get some of the other open PRs / obvious bugs cleaned up. Thanks!