From 907b5ee3bf0ca30104994293216b87382954b7b8 Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Wed, 29 Apr 2026 09:40:58 +0800 Subject: [PATCH] fix(room): fix file upload missing /api prefix and credentials Upload URL was missing /api prefix causing 404, and missing credentials: 'include' for cookie-based authentication. --- src/components/room/message/MessageInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/room/message/MessageInput.tsx b/src/components/room/message/MessageInput.tsx index dd2e595..748aa7e 100644 --- a/src/components/room/message/MessageInput.tsx +++ b/src/components/room/message/MessageInput.tsx @@ -166,7 +166,7 @@ export const MessageInput = forwardRef(fu const formData = new FormData(); formData.append('file', file); const baseUrl = import.meta.env.VITE_API_BASE_URL ?? window.location.origin; - const res = await fetch(`${baseUrl}/rooms/${activeRoomId}/upload`, {method: 'POST', body: formData}); + const res = await fetch(`${baseUrl}/api/rooms/${activeRoomId}/upload`, {method: 'POST', body: formData, credentials: 'include'}); if (!res.ok) throw new Error('Upload failed'); return res.json(); };