Skip to content

Commit

Permalink
Fix rendering of images with too small aspect ratios (mastodon#29310)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeraltaBoi committed Apr 4, 2024
1 parent 1c87cb8 commit 4896083
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/javascript/mastodon/components/media_gallery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ class MediaGallery extends PureComponent {

isFullSizeEligible() {
const { media } = this.props;
return media.size === 1 && media.getIn([0, 'meta', 'small', 'aspect']);
const aspect = media.getIn([0, 'meta', 'small', 'aspect']);
const minAspectRatioThreshold = 3/2;
return media.size === 1 && typeof aspect === 'number' && aspect >= minAspectRatioThreshold;
}

render () {
Expand Down

0 comments on commit 4896083

Please sign in to comment.