From e42c69c2b1e7b9a2f7f4253392286e54f9fbe395 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 7 Dec 2023 22:07:22 +0300 Subject: [PATCH] caption-fix --- src/components/Article/FullArticle.tsx | 2 +- src/utils/getImageUrl.ts | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index 83378973..205f54cf 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -317,7 +317,7 @@ export const FullArticle = (props: Props) => { props.article.layout !== 'image' } > - {props.article.title} + {props.article.cover_caption} diff --git a/src/utils/getImageUrl.ts b/src/utils/getImageUrl.ts index 93f7f616..1d7123d7 100644 --- a/src/utils/getImageUrl.ts +++ b/src/utils/getImageUrl.ts @@ -14,12 +14,5 @@ const getSizeUrlPart = (options: { width?: number; height?: number } = {}) => { export const getImageUrl = (src: string, options: { width?: number; height?: number } = {}) => { const sizeUrlPart = getSizeUrlPart(options) - const thumborPrefix = `${thumborUrl}/unsafe/` - - if (src.startsWith(thumborPrefix)) { - const thumborKey = src.replace(thumborPrefix, '') - return `${thumborUrl}/unsafe/${sizeUrlPart}${thumborKey}` - } - - return `${thumborUrl}/unsafe/${sizeUrlPart}${src}` + return `${thumborUrl}/unsafe/${sizeUrlPart}${src.replace(thumborUrl, '').replace('/unsafe', '')}` }