Handle "unknown" media

On mastodon.social, images have type:image, but hachyderm returns type:unknown

Found this when editing a post and add two images, on mastodon.social.
This commit is contained in:
Lim Chee Aun 2022-12-16 09:20:30 +08:00
parent 7762c5b6a7
commit 3ae82d6898

View file

@ -54,7 +54,8 @@ function Media({ media, showOriginal, onClick }) {
focalBackgroundPosition = `${x.toFixed(0)}% ${y.toFixed(0)}%`; focalBackgroundPosition = `${x.toFixed(0)}% ${y.toFixed(0)}%`;
} }
if (type === 'image') { if (type === 'image' || (type === 'unknown' && previewUrl && url)) {
// Note: type: unknown might not have width/height
return ( return (
<div <div
class={`media media-image`} class={`media media-image`}