put a space before file link too

pull/142/head
Aevann 2023-03-17 19:40:55 +02:00
parent 0b0ad438a8
commit 8d096e1123
2 changed files with 7 additions and 7 deletions

View File

@ -56,11 +56,11 @@ def process_files(files, v, body):
name = f'/images/{time.time()}'.replace('.','') + '.webp'
file.save(name)
url = process_image(name, v)
body = body.replace(f'[{file.filename}]', f'{url} ', 1)
body = body.replace(f'[{file.filename}]', f' {url} ', 1)
elif file.content_type.startswith('video/'):
body = body.replace(f'[{file.filename}]', f'{process_video(file, v)} ', 1)
body = body.replace(f'[{file.filename}]', f' {process_video(file, v)} ', 1)
elif file.content_type.startswith('audio/'):
body = body.replace(f'[{file.filename}]', f"{SITE_FULL}{process_audio(file, v)} ", 1)
body = body.replace(f'[{file.filename}]', f' {SITE_FULL}{process_audio(file, v)} ', 1)
else:
abort(415)
@ -316,7 +316,7 @@ def process_dm_images(v, user, body):
try: url = req['files'][0]['url']
except: abort(400, req['description'])
body = body.replace(f'[{file.filename}]', f'{url} ', 1)
body = body.replace(f'[{file.filename}]', f' {url} ', 1)
with open(f"{LOG_DIRECTORY}/dm_images.log", "a+", encoding="utf-8") as f:
if user:

View File

@ -211,11 +211,11 @@ def comment(v:User):
purge_files_in_cache(f"https://{SITE}/assets/images/badges/{badge.id}.webp")
except Exception as e:
abort(400, str(e))
body = body.replace(f'[{file.filename}]', f'{image} ', 1)
body = body.replace(f'[{file.filename}]', f' {image} ', 1)
elif file.content_type.startswith('video/'):
body = body.replace(f'[{file.filename}]', f'{process_video(file, v)} ', 1)
body = body.replace(f'[{file.filename}]', f' {process_video(file, v)} ', 1)
elif file.content_type.startswith('audio/'):
body = body.replace(f'[{file.filename}]', f"{SITE_FULL}{process_audio(file, v)} ", 1)
body = body.replace(f'[{file.filename}]', f' {SITE_FULL}{process_audio(file, v)} ', 1)
else:
abort(415)