forked from UKSOURCE/hailearning.edu.vn
Merge pull request 'fea/thanh-02022026-news' (#17) from fea/thanh-02022026-news into main
Reviewed-on: UKSOURCE/hailearning.edu.vn#17
This commit is contained in:
@@ -22,7 +22,6 @@ export default function RootLayout({
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<link rel="shortcut icon" href="/assets/img/favicon.png" />
|
<link rel="shortcut icon" href="/assets/img/favicon.png" />
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="/assets/css/bootstrap.min.css" />
|
||||||
<link rel="stylesheet" href="/assets/css/all.min.css" />
|
<link rel="stylesheet" href="/assets/css/all.min.css" />
|
||||||
<link rel="stylesheet" href="/assets/css/animate.css" />
|
<link rel="stylesheet" href="/assets/css/animate.css" />
|
||||||
|
|||||||
@@ -14,9 +14,18 @@ export function getCmsImageUrl(imagePath: string | undefined): string {
|
|||||||
return imagePath;
|
return imagePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imagePath.startsWith("/uploads/") || imagePath.startsWith("/img/")) {
|
// Hỗ trợ cả "/uploads/", "uploads/", "/img/", "img/"
|
||||||
|
if (
|
||||||
|
imagePath.startsWith("/uploads/") ||
|
||||||
|
imagePath.startsWith("uploads/") ||
|
||||||
|
imagePath.startsWith("/img/") ||
|
||||||
|
imagePath.startsWith("img/")
|
||||||
|
) {
|
||||||
const apiUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001";
|
const apiUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001";
|
||||||
return `${apiUrl}${imagePath}`;
|
// Nếu thiếu dấu "/" đầu, thêm vào cho đúng path
|
||||||
|
const fixedPath =
|
||||||
|
imagePath.startsWith("/") ? imagePath : `/${imagePath}`;
|
||||||
|
return `${apiUrl}${fixedPath}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imagePath.startsWith("/")) {
|
if (imagePath.startsWith("/")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user