fix: extract pathname from absolute image URLs to avoid container host leaking
All checks were successful
Deploy to Server / deploy (push) Successful in 1m54s
All checks were successful
Deploy to Server / deploy (push) Successful in 1m54s
This commit is contained in:
@@ -17,10 +17,10 @@ const { useBreakpoint } = Grid;
|
||||
|
||||
const getImageUrl = (url) => {
|
||||
if (!url) return '';
|
||||
if (url.startsWith('http') || url.startsWith('//')) return url;
|
||||
const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000/api';
|
||||
const baseUrl = apiUrl.replace(/\/api\/?$/, '');
|
||||
return `${baseUrl}${url}`;
|
||||
if (url.startsWith('http') || url.startsWith('//')) {
|
||||
try { return new URL(url).pathname; } catch { return url; }
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
const CodeBlock = ({ inline, className, children, ...props }) => {
|
||||
|
||||
@@ -11,8 +11,10 @@ const { Title, Paragraph } = Typography;
|
||||
// 获取完整图片 URL
|
||||
const getImageUrl = (url) => {
|
||||
if (!url) return '';
|
||||
if (url.startsWith('http') || url.startsWith('//')) return url;
|
||||
return `http://localhost:8876${url}`;
|
||||
if (url.startsWith('http') || url.startsWith('//')) {
|
||||
try { return new URL(url).pathname; } catch { return url; }
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
const Home = () => {
|
||||
|
||||
Reference in New Issue
Block a user