Аватар
This commit is contained in:
@@ -137,8 +137,7 @@ export function getMediaUrl(url: string | null | undefined): string {
|
||||
if (!url) return '';
|
||||
if (url.startsWith('http') || url.startsWith('blob:') || url.startsWith('data:')) return url;
|
||||
|
||||
// Use VITE_API_URL if defined, otherwise let it be a relative path which the browser
|
||||
// will resolve against the current origin (port).
|
||||
const baseUrl = import.meta.env.VITE_API_URL || '';
|
||||
// Use VITE_API_URL if defined, but avoid duplicating '/api'
|
||||
const baseUrl = (import.meta.env.VITE_API_URL || '').replace(/\/api$/, '');
|
||||
return `${baseUrl}${url.startsWith('/') ? '' : '/'}${url}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user