From 33c1607c83f186cf7b47fc083549506a18da2704 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Mon, 9 Jul 2018 22:26:19 +0200 Subject: [PATCH] [Glitch] Fix Chrome issue with sizes="0px" --- app/javascript/flavours/glitch/components/media_gallery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/components/media_gallery.js b/app/javascript/flavours/glitch/components/media_gallery.js index d90f9bdb4..d87be14cc 100644 --- a/app/javascript/flavours/glitch/components/media_gallery.js +++ b/app/javascript/flavours/glitch/components/media_gallery.js @@ -142,7 +142,7 @@ class Item extends React.PureComponent { const hasSize = typeof originalWidth === 'number' && typeof previewWidth === 'number'; const srcSet = hasSize ? `${originalUrl} ${originalWidth}w, ${previewUrl} ${previewWidth}w` : null; - const sizes = hasSize ? `${displayWidth * (width / 100)}px` : null; + const sizes = hasSize && (displayWidth > 0) ? `${displayWidth * (width / 100)}px` : null; const focusX = attachment.getIn(['meta', 'focus', 'x']) || 0; const focusY = attachment.getIn(['meta', 'focus', 'y']) || 0;