From d9d94af022d2b10e23f435608cbe98148866df83 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Fri, 9 May 2025 04:00:12 -0400 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=92=8C=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/dashboard/routes/file.py | 5 +---- astrbot/dashboard/routes/static_file.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/astrbot/dashboard/routes/file.py b/astrbot/dashboard/routes/file.py index 44c92ad07..8ea73d084 100644 --- a/astrbot/dashboard/routes/file.py +++ b/astrbot/dashboard/routes/file.py @@ -19,9 +19,6 @@ class FileRoute(Route): try: file_path = await file_token_service.handle_file(file_token) return await send_file(file_path) - except FileNotFoundError as e: - logger.warning(str(e)) - return abort(404) - except KeyError as e: + except (FileNotFoundError, KeyError) as e: logger.warning(str(e)) return abort(404) diff --git a/astrbot/dashboard/routes/static_file.py b/astrbot/dashboard/routes/static_file.py index 4503a28e5..729fe8547 100644 --- a/astrbot/dashboard/routes/static_file.py +++ b/astrbot/dashboard/routes/static_file.py @@ -28,7 +28,7 @@ class StaticFileRoute(Route): @self.app.errorhandler(404) async def page_not_found(e): - return "404 Not found。如果你初次使用打开面板发现 404, 请参考文档: https://astrbot.app/faq.html。" + return "404 Not found。如果你初次使用打开面板发现 404, 请参考文档: https://astrbot.app/faq.html。如果你正在测试回调地址可达性,显示这段文字说明测试成功了。" async def index(self): return await self.app.send_static_file("index.html")