From afb20d3ae0e4d0e11e584bc52bd63346bc4c5bc9 Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Sun, 18 Jan 2026 13:33:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E7=9A=84=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 14340 -> 14340 bytes frontend/src/components/UserAuth.tsx | 3 +-- frontend/src/pages/admin/AdminLayout.tsx | 3 +-- frontend/src/pages/admin/UserProfile.tsx | 5 ++--- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.DS_Store b/.DS_Store index 9ef2c6d9dff368157bcdfeac5bdf8cf5b209a63c..de14da25624a6d7ecbb3fb95f7b568f3457ac3b4 100644 GIT binary patch delta 59 ucmZoEXeromRzbwbQb)ni(6ClVq1w>c*hojg+}L#ULxmb<>@tNalZ62Xr4Um9 delta 25 fcmZoEXeromR$;P|sQYFSMNeiR!(;POm3UzQe@6(* diff --git a/frontend/src/components/UserAuth.tsx b/frontend/src/components/UserAuth.tsx index 782170d..7ff2394 100644 --- a/frontend/src/components/UserAuth.tsx +++ b/frontend/src/components/UserAuth.tsx @@ -27,8 +27,7 @@ export function UserAuth({ user, onOpenAuth, onLogout, onNavigateToAdmin }: User // Helper to get full avatar URL const getAvatarUrl = () => { if (!user?.avatar_url) return null; - const rootUrl = API_BASE_URL.replace('/api', ''); - return `${rootUrl}/upload/${user.avatar_url}`; + return `/upload/${user.avatar_url}`; }; return ( diff --git a/frontend/src/pages/admin/AdminLayout.tsx b/frontend/src/pages/admin/AdminLayout.tsx index 572d0f5..6023a04 100644 --- a/frontend/src/pages/admin/AdminLayout.tsx +++ b/frontend/src/pages/admin/AdminLayout.tsx @@ -66,8 +66,7 @@ export function AdminLayout() { // Helper to get full avatar URL const getAvatarUrl = () => { if (!user?.avatar_url) return null; - const rootUrl = API_BASE_URL.replace('/api', ''); - return `${rootUrl}/upload/${user.avatar_url}`; + return `/upload/${user.avatar_url}`; }; // Load menus from backend diff --git a/frontend/src/pages/admin/UserProfile.tsx b/frontend/src/pages/admin/UserProfile.tsx index 6c211c3..22000ee 100644 --- a/frontend/src/pages/admin/UserProfile.tsx +++ b/frontend/src/pages/admin/UserProfile.tsx @@ -88,10 +88,9 @@ export function UserProfile() { // Construct full avatar URL const getAvatarUrl = () => { if (!userProfile?.avatar_url) return null; + // Use relative path to allow proxying (Vite/Nginx) // The backend returns a relative path like "user/1/avatar/avatar.png" - // The upload directory is mounted at /upload - const rootUrl = API_BASE_URL.replace('/api', ''); - return `${rootUrl}/upload/${userProfile.avatar_url}?t=${new Date().getTime()}`; + return `/upload/${userProfile.avatar_url}?t=${new Date().getTime()}`; }; return (