From 19d2f5f393c8e51394149b3d81cb4ba88bad6bfb Mon Sep 17 00:00:00 2001 From: ekzyis Date: Tue, 3 Oct 2023 16:56:20 +0200 Subject: [PATCH] Fix text of markdown links not used on imgproxy errors --- components/image.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/image.js b/components/image.js index a25762df1b..fb88bfd3e0 100644 --- a/components/image.js +++ b/components/image.js @@ -42,12 +42,16 @@ function ImageOriginal ({ src, topLevel, nofollow, tab, children, onClick, ...pr ) } else { // user is not okay with loading original url automatically or there was an error loading the image + + // If element parsed by markdown is a raw URL, we use src as the text to not mislead users. + // This will not be the case if [text](url) format is used. Then we will show what was chosen as text. + const isRawURL = /^https?:\/\//.test(children[0]) return ( {src} + >{isRawURL ? src : children} ) }