about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/components/media_modal.js
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-07-09 00:21:59 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-07-08 17:21:59 +0200
commit76318f88306656a4a74f190375a78713327bc4e4 (patch)
tree2a15a22f78ebb218c5b903f8231bb4a5e436d4c9 /app/javascript/mastodon/features/ui/components/media_modal.js
parent852bda3d320563400eaa74f02ef0c6c73cd8180d (diff)
Don't use preview when image size is unknown (#4113)
Diffstat (limited to 'app/javascript/mastodon/features/ui/components/media_modal.js')
-rw-r--r--app/javascript/mastodon/features/ui/components/media_modal.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/ui/components/media_modal.js b/app/javascript/mastodon/features/ui/components/media_modal.js
index 8bb81ca01..a5b9dc19f 100644
--- a/app/javascript/mastodon/features/ui/components/media_modal.js
+++ b/app/javascript/mastodon/features/ui/components/media_modal.js
@@ -74,7 +74,10 @@ export default class MediaModal extends ImmutablePureComponent {
     }
 
     if (attachment.get('type') === 'image') {
-      content = <ImageLoader previewSrc={attachment.get('preview_url')} src={url} width={attachment.getIn(['meta', 'original', 'width'])} height={attachment.getIn(['meta', 'original', 'height'])} />;
+      const width  = attachment.getIn(['meta', 'original', 'width']) || null;
+      const height = attachment.getIn(['meta', 'original', 'height']) || null;
+
+      content = <ImageLoader previewSrc={attachment.get('preview_url')} src={url} width={width} height={height} />;
     } else if (attachment.get('type') === 'gifv') {
       content = <ExtendedVideoPlayer src={url} muted controls={false} />;
     }