remotes/1693045480750635534/spooky-22
parent
0fc83368f1
commit
698800628e
|
@ -148,7 +148,7 @@ def api_comment(v):
|
||||||
|
|
||||||
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
|
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
|
||||||
|
|
||||||
for i in re.finditer('(^| )(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
|
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)})')
|
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 = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ def edit_comment(cid, v):
|
||||||
if c.is_banned or c.deleted_utc > 0: abort(403)
|
if c.is_banned or c.deleted_utc > 0: abort(403)
|
||||||
|
|
||||||
body = request.values.get("body", "")[:10000]
|
body = request.values.get("body", "")[:10000]
|
||||||
for i in re.finditer('(^| )(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
|
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)})')
|
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
|
||||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
|
|
|
@ -103,7 +103,7 @@ def settings_profile_post(v):
|
||||||
if request.values.get("bio"):
|
if request.values.get("bio"):
|
||||||
bio = request.values.get("bio")[:1500]
|
bio = request.values.get("bio")[:1500]
|
||||||
|
|
||||||
for i in re.finditer('(^| )(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE):
|
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE):
|
||||||
if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'![]({i.group(1)})')
|
if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'![]({i.group(1)})')
|
||||||
bio = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', bio)
|
bio = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', bio)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue