forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-07-27 02:44:00 +02:00
parent ff380f7369
commit 82f807cabb
3 changed files with 5 additions and 5 deletions

View File

@ -264,7 +264,7 @@ def api_comment(v):
if not body and not request.files.get('file'): return jsonify({"error":"You need to actually write something!"}), 400
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif))', body.lower(), re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})').replace(i.group(1).upper(), f'![]({i.group(1)})')
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF))', body, re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})')
body = body.replace("\n", "\n\n")
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
body_html = sanitize(body_md, linkgen=True)
@ -649,7 +649,7 @@ def edit_comment(cid, v):
if c.is_banned or c.deleted_utc > 0: abort(403)
body = request.form.get("body", "")[0:10000]
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif))', body.lower(), re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})').replace(i.group(1).upper(), f'![]({i.group(1)})')
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF))', body, re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})')
body = body.replace("\n", "\n\n")
with CustomRenderer(post_id=c.post.base36id) as renderer: body_md = renderer.render(mistletoe.Document(body))
body_html = sanitize(body_md, linkgen=True)

View File

@ -260,7 +260,7 @@ def edit_post(pid, v):
abort(403)
body = request.form.get("body", "")
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif))', body.lower(), re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})').replace(i.group(1).upper(), f'![]({i.group(1)})')
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF))', body, re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})')
body = body.replace("\n", "\n\n")
with CustomRenderer() as renderer:
body_md = renderer.render(mistletoe.Document(body))
@ -794,7 +794,7 @@ def submit_post(v):
}
# render text
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif))', body.lower(), re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})').replace(i.group(1).upper(), f'![]({i.group(1)})')
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF))', body, re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})')
body = body.replace("\n", "\n\n")
with CustomRenderer() as renderer:
body_md = renderer.render(mistletoe.Document(body))

View File

@ -69,7 +69,7 @@ def settings_profile_post(v):
v=v,
error="You didn't change anything")
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif))', bio.lower(), re.MULTILINE): bio = bio.replace(i.group(1), f'![]({i.group(1)})').replace(i.group(1).upper(), f'![]({i.group(1)})')
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF))', bio, re.MULTILINE): bio = bio.replace(i.group(1), f'![]({i.group(1)})')
bio = bio.replace("\n", "\n\n")
with CustomRenderer() as renderer:
bio_html = renderer.render(mistletoe.Document(bio))