From 03a352c18eba23c79b2c12eb0091aa683c489b5f Mon Sep 17 00:00:00 2001 From: root Date: Sun, 1 Jun 2025 21:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E9=99=A4=E6=97=A5=E5=BF=97=E4=B8=AD?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=96=87=E4=BB=B6=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/middlewares.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/core/middlewares.py b/app/core/middlewares.py index b027baa..08d8a8e 100644 --- a/app/core/middlewares.py +++ b/app/core/middlewares.py @@ -68,7 +68,14 @@ class HttpAuditLogMiddleware(BaseHTTPMiddleware): except json.JSONDecodeError: try: body = await request.form() - args.update(body) + # args.update(body) + for k, v in body.items(): + if hasattr(v, "filename"): # 文件上传行为 + args[k] = v.filename + elif isinstance(v, list) and v and hasattr(v[0], "filename"): + args[k] = [file.filename for file in v] + else: + args[k] = v except Exception: pass