diff --git a/files/helpers/const.py b/files/helpers/const.py index 401245143..296f021f1 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -998,7 +998,7 @@ approved_embed_hosts = { def is_site_url(url): - return url and '\\' not in url and (url.startswith('/') or url.startswith(f'{SITE_FULL}/')) + return url and '\\' not in url and ((url.startswith('/') and not url.startswith('//')) or url.startswith(f'{SITE_FULL}/')) def is_safe_url(url): return is_site_url(url) or tldextract.extract(url).registered_domain in approved_embed_hosts diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 0ba20a247..437b8b5ca 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -80,7 +80,7 @@ image_regex = re.compile("(^|\s)(https:\/\/[\w\-.#&/=\?@%;+,:]{5,250}(\.png|\.jp link_fix_regex = re.compile("(\[.*?\]\()(?!http|/)(.*?\))", flags=re.A) -css_regex = re.compile('https?:\/\/[\w:~,()\-.#&\/=?@%;+]*', flags=re.I|re.A) +css_regex = re.compile('(https?:)?\/\/[\w:~,()\-.#&\/=?@%;+]*', flags=re.I|re.A) procoins_li = (0,2500,5000,10000,25000,50000,125000,250000)