From 111793fb9a1d5e4dd8368a26d368d57ce2e9fac3 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 2 Nov 2026 15:51:55 +0800 Subject: [PATCH] fix: allow direct access for file owners in chat source type --- apps/oss/serializers/file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/oss/serializers/file.py b/apps/oss/serializers/file.py index 6e5bbcd9be2..9ebd7875b6e 100644 --- a/apps/oss/serializers/file.py +++ b/apps/oss/serializers/file.py @@ -317,6 +317,10 @@ def _auth_system(file, user_id): user_auth = get_auth(user) if file.source_type == FileSourceType.CHAT: + # 调试等场景可能使用前端生成的会话 ID,首条消息发送前 Chat 记录尚未创建; + # 文件归属者为当前用户时直接放行。 + if file.meta.get("user_id") == user_id: + return application = QuerySet(Application).filter(chat__id=file.source_id).first() if application is None: _deny()