fix images again

pull/139/head
Aevann 2023-03-15 05:07:43 +02:00
parent a4128b32fe
commit 903fb21961
2 changed files with 3 additions and 5 deletions

View File

@ -57,8 +57,7 @@ def process_files(files, v, body):
name = f'/images/{time.time()}'.replace('.','') + '.webp'
file.save(name)
url = process_image(name, v)
print(f'{url} ', flush=True)
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}]', process_video(file, v), 1)
elif file.content_type.startswith('audio/'):
@ -66,7 +65,6 @@ def process_files(files, v, body):
else:
abort(415)
print(body, flush=True)
return body
@ -298,7 +296,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}]', 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,7 +211,7 @@ 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}]', image, 1)
body = body.replace(f'[{file.filename}]', f'{image} ', 1)
elif file.content_type.startswith('video/'):
body = body.replace(f'[{file.filename}]', process_video(file, v), 1)
elif file.content_type.startswith('audio/'):