Skip to content

Commit 8444be6

Browse files
committed
github: skip URL handling for links under special site sections
Trending, events, collections, etc. are not real users and generate "Not Found" if their URLs happen to match the format of e.g. a repo URL. We can skip them and let the built-in title plugin do it.
1 parent c90632d commit 8444be6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sopel_modules/github/github.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949
# GitHub enforces alphanumeric usernames, and allows only one punctuation character: hyphen ('-')
5050
# Regex copied and slightly modified to meet our needs from CC0 source:
5151
# https://github.com/shinnn/github-username-regex/blob/0794566cc10e8c5a0e562823f8f8e99fa044e5f4/module.js#L1
52-
githubUsername = r'[A-Za-z\d](?:[A-Za-z\d]|-(?=[A-Za-z\d])){0,38}'
52+
githubUsername = (
53+
r'(?!(?:collections|events|sponsors|topics|trending)/)' # exclude special sections
54+
r'[A-Za-z\d](?:[A-Za-z\d]|-(?=[A-Za-z\d])){0,38}'
55+
)
5356
# GitHub additionally allows dots ('.') in repo names, as well as hyphens
5457
# not copied from anywhere, but handy to simply reuse
5558
githubRepoSlug = r'[A-Za-z0-9\.\-]+'

0 commit comments

Comments
 (0)