master
Aevann1 2021-12-10 22:24:34 +02:00
parent 7bc73c8273
commit 9455bae222
3 changed files with 10 additions and 10 deletions

View File

@ -195,7 +195,7 @@ def api_comment(v):
file=request.files["file"]
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
url = request.host_url[:-1] + process_image(name)
@ -728,7 +728,7 @@ def edit_comment(cid, v):
file=request.files["file"]
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
url = request.host_url[:-1] + process_image(name)

View File

@ -381,7 +381,7 @@ def edit_post(pid, v):
file=request.files["file"]
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
url = request.host_url[:-1] + process_image(name)
@ -650,7 +650,7 @@ def thumbnail_thread(pid):
db.close()
return
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
with open(name, "wb") as file:
for chunk in image_req.iter_content(1024):
@ -872,7 +872,7 @@ def submit_post(v):
file=request.files["file2"]
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
url = request.host_url[:-1] + process_image(name)
@ -960,7 +960,7 @@ def submit_post(v):
), 403
if file.content_type.startswith('image/'):
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
new_post.url = request.host_url[:-1] + process_image(name)

View File

@ -124,7 +124,7 @@ def settings_profile_post(v):
if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
else: return render_template("settings_profile.html", v=v, error=f"Image files only."), 400
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
url = request.host_url[:-1] + process_image(name)
@ -314,7 +314,7 @@ def settings_profile_post(v):
if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
else: return render_template("settings_profile.html", v=v, error=f"Image files only."), 400
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
url = request.host_url[:-1] + process_image(name)
@ -720,7 +720,7 @@ def settings_images_profile(v):
file = request.files["profile"]
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
highres = request.host_url[:-1] + process_image(name)
@ -756,7 +756,7 @@ def settings_images_banner(v):
file = request.files["banner"]
name = f'/images/{time.time()}'.replace('.','') + '.webp'
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
file.save(name)
bannerurl = request.host_url[:-1] + process_image(name)