From a7447ffcb78ba666b27b264dd4908b8c7d55417e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9A=E7=BE=85=E7=8B=BC?= Date: Thu, 25 Jan 2024 18:54:38 +0800 Subject: [PATCH] fix --- core/utils/http.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/utils/http.py b/core/utils/http.py index bba18751..f1bb9427 100644 --- a/core/utils/http.py +++ b/core/utils/http.py @@ -191,8 +191,10 @@ async def download_to_cache(url: str, filename=None, status_code: int = False, m if data: if not filename: - ftt = ft.match(data).extension - ftt = '.txt' if not ftt else ftt + try: + ftt = ft.match(data).extension + except AttributeError: + ftt = 'txt' path = f'{random_cache_path()}.{ftt}' else: path = Config("cache_path") + f'/{filename}'