From 9541e3db47ba512c1ce9456363c6e7ae63ed0414 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 8 May 2022 06:10:33 +0200 Subject: [PATCH] sfd --- files/routes/comments.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 0cdc5c888..ef4869f87 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -228,14 +228,14 @@ def api_comment(v): if image == "": return {"error":"Image upload failed"} if v.admin_level > 2 and level == 1: if parent_post.id == 37696: - num = int(os.listdir('files/assets/images/rDrama/sidebar')[-1].split('.webp')[0]) + 1 + num = int(sorted(os.listdir('files/assets/images/rDrama/sidebar'))[-1].split('.webp')[0]) + 1 print(num) filename = f'files/assets/images/rDrama/sidebar/{num}.webp' copyfile(oldname, filename) process_image(v.patron, filename, 400) print(num) elif parent_post.id == 37697: - num = int(os.listdir('files/assets/images/rDrama/banners')[-1].split('.webp')[0]) + 1 + num = int(sorted(os.listdir('files/assets/images/rDrama/banners'))[-1].split('.webp')[0]) + 1 filename = f'files/assets/images/rDrama/banners/{num}.webp' copyfile(oldname, filename) process_image(v.patron, filename)