From 461c13f5f896957afa36a68bb43d6a23ff65b4ca Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Fri, 7 Feb 2025 01:01:10 +0300 Subject: [PATCH] Fix handling of negative channel IDs in media download --- api_server.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api_server.py b/api_server.py index 0558961..5ddeab3 100644 --- a/api_server.py +++ b/api_server.py @@ -252,7 +252,16 @@ async def download_new_files(media_files: list, cache_dir: str): if not file_id: continue + # Handle negative channel IDs + has_minus = file_id.startswith('-') + if has_minus: + file_id = file_id[1:] # Remove minus + channel, post_id_str, file_unique_id = file_id.split('-', 2) + + if has_minus: + channel = f"-{channel}" # Restore minus + post_id = int(post_id_str) cache_path = os.path.join(cache_dir, f"{channel}-{post_id}-{file_unique_id}")