lint: improve HTTPS check

It was missing some domains, so I added another rule.  @IzzySoft pointed
out it was redudnant, so this removes the redudant rule and fixes the
original.

https://gitlab.com/fdroid/fdroidserver/merge_requests/681/diffs#note_225263464
This commit is contained in:
Hans-Christoph Steiner 2019-10-03 23:46:34 +02:00
parent a8b7342e4c
commit 3801db064a
2 changed files with 6 additions and 6 deletions

View file

@ -33,7 +33,7 @@ options = None
def enforce_https(domain):
return (re.compile(r'^[^h][^t][^t][^p][^s]://[^/]*' + re.escape(domain) + r'(/.*)?', re.IGNORECASE),
return (re.compile(r'^http://([^/]*\.)?' + re.escape(domain) + r'(/.*)?', re.IGNORECASE),
domain + " URLs should always use https://")
@ -122,11 +122,9 @@ http_url_shorteners = [
http_checks = https_enforcings + http_url_shorteners + [
(re.compile(r'^(?!https?://)[^/]+'),
_("URL must start with https:// or http://")),
(re.compile(r'^http://[^.]+\.(github|gitlab)\.io/'),
_("URL must start with https://")),
(re.compile(r'^https://(github|gitlab)\.com(/[^/]+){2,3}\.git'),
_("Appending .git is not necessary")),
(re.compile(r'^https://[^/]*(github|gitlab|bitbucket|rawgit)\.[a-zA-Z]+/([^/]+/){2,3}master/'),
(re.compile(r'^https://[^/]*(github|gitlab|bitbucket|rawgit|githubusercontent)\.[a-zA-Z]+/([^/]+/){2,3}master/'),
_("Use /HEAD instead of /master to point at a file in the default branch")),
]