Skip to content

Commit

Permalink
Merge pull request #3932 from owid/fix-data-insight-images
Browse files Browse the repository at this point in the history
🐛 fix PNG assumption in AtomArticleBlocks
  • Loading branch information
ikesau authored Sep 6, 2024
2 parents e468790 + 65873cf commit 97b107b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion site/gdocs/components/AtomArticleBlocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ function Image({
? Math.round(LARGEST_IMAGE_WIDTH / aspectRatio)
: undefined

const extension = getFilenameExtension(image.filename)
// If we're using a resized image (i.e. it has a width suffix), the file extension is ALWAYS png
// If we're using the original image, we need to check the original file extension (which SHOULD be png, but might not be)
const extension = widthSuffix ? "png" : getFilenameExtension(filename)

return (
<img
src={`${BAKED_BASE_URL}${IMAGES_DIRECTORY}${filenameWithoutExtension}${widthSuffix}.${extension}`}
Expand Down

0 comments on commit 97b107b

Please sign in to comment.