Disallow any branch name in checks_vcs_permalinks

This commit is contained in:
jack1142 2021-04-06 20:07:08 +02:00 committed by Anthony Sottile
parent 4195f4d271
commit 4729918bc9
2 changed files with 9 additions and 2 deletions

View file

@ -8,7 +8,10 @@ from typing import Sequence
def _get_pattern(domain: str) -> Pattern[bytes]:
regex = rf'https://{domain}/[^/ ]+/[^/ ]+/blob/master/[^# ]+#L\d+'
regex = (
rf'https://{domain}/[^/ ]+/[^/ ]+/blob/'
r'(?![a-fA-F0-9]{4,64}/)([^/. ]+)/[^# ]+#L\d+'
)
return re.compile(regex.encode())