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