From eafc8957248c8b35659df002dd7703ed7c017c3e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 8 May 2022 06:17:50 +0200 Subject: [PATCH] fsd --- files/routes/comments.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index ef4869f87..709028079 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -228,7 +228,10 @@ 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(sorted(os.listdir('files/assets/images/rDrama/sidebar'))[-1].split('.webp')[0]) + 1 + li = os.listdir('files/assets/images/rDrama/sidebar') + li = [int(x.split('.webp')[0]) for x in li] + li = sorted(li) + num = li[[-1]] + 1 print(num) filename = f'files/assets/images/rDrama/sidebar/{num}.webp' copyfile(oldname, filename)