core-maugli 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -94,14 +94,22 @@ const isBrandDate = isToday || isYesterday;
|
|
94
94
|
function getPreviewImageSrc(imageSrc: string): string {
|
95
95
|
if (!imageSrc) return maugliConfig.defaultRubricImage;
|
96
96
|
|
97
|
-
//
|
97
|
+
// Если это изображение по умолчанию, возвращаем его превью напрямую
|
98
|
+
if (imageSrc === maugliConfig.defaultRubricImage) {
|
99
|
+
return '/img/default/previews/rubric_default.webp';
|
100
|
+
}
|
101
|
+
|
102
|
+
// Для кастомных изображений проверяем, есть ли превью
|
98
103
|
const pathParts = imageSrc.split('/');
|
99
104
|
const fileName = pathParts.pop();
|
100
105
|
const directory = pathParts.join('/');
|
101
106
|
const previewPath = `${directory}/previews/${fileName}`;
|
102
107
|
|
108
|
+
// Убеждаемся, что путь абсолютный (начинается с /)
|
109
|
+
const absolutePreviewPath = previewPath.startsWith('/') ? previewPath : `/${previewPath}`;
|
110
|
+
|
103
111
|
// Возвращаем путь к превью (браузер покажет оригинал, если превью не найдено)
|
104
|
-
return
|
112
|
+
return absolutePreviewPath;
|
105
113
|
}
|
106
114
|
|
107
115
|
const imageSrc = image?.src || maugliConfig.defaultRubricImage;
|