fix css_url_regex

pull/200/head
Aevann 2023-09-07 16:04:10 +03:00
parent 9386a55933
commit 67d86bc53d
2 changed files with 2 additions and 4 deletions

View File

@ -128,8 +128,7 @@ twitch_regex = re.compile('(https:\/\/)?(www\.)?twitch.tv\/(.*)', flags=re.I|re.
link_fix_regex = re.compile("(\[.*?\]\()(?!http|\/)(.*?\))" + NOT_IN_CODE_OR_LINKS, flags=re.A)
css_url_regex = re.compile('url\(\s*[\'"]?([^\'"]*)', flags=re.I|re.A)
css_url2_regex = re.compile('(http[^\s]*)', flags=re.I|re.A)
css_url_regex = re.compile('url\(((.|\n)*?)\)', flags=re.I|re.A)
linefeeds_regex = re.compile("([^\n])\n([^\n])", flags=re.A)

View File

@ -804,8 +804,7 @@ def validate_css(css):
if '/*' in css:
return False, "CSS comments are not allowed!"
matches = list(css_url_regex.finditer(css)) + list(css_url2_regex.finditer(css))
for i in matches:
for i in css_url_regex.finditer(css):
url = i.group(1)
if not is_safe_url(url):
domain = tldextract.extract(url).registered_domain