This commit is contained in:
Aevann1 2021-11-04 17:20:10 +02:00
parent fe551f0700
commit 14b8fb0f6b
6 changed files with 12 additions and 27 deletions

View file

@ -166,7 +166,6 @@ def api_comment(v):
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
body_md = body
options = []
@ -183,7 +182,6 @@ def api_comment(v):
url = request.host_url[:-1] + process_image(name)
body = request.values.get("body") + f"\n![]({url})"
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
body_md = CustomRenderer().render(mistletoe.Document(body))
body_html = sanitize(body_md)
else:
@ -398,7 +396,6 @@ def api_comment(v):
if "rama" in request.host and len(c.body) >= 1000 and "<" not in body and "</blockquote>" not in body_html:
body = random.choice(LONGPOST_REPLIES)
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
body_md = CustomRenderer().render(mistletoe.Document(body))
body_html2 = sanitize(body_md)