Fix handling of negative channel IDs in media download

This commit is contained in:
vvzvlad
2025-02-07 01:01:10 +03:00
parent c9c7c35b4d
commit 461c13f5f8
+9
View File
@@ -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}")