1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-25 11:43:07 +01:00

Fix regression where generic embed handler wouldn't properly send image results

This commit is contained in:
Madeline 2023-09-16 23:43:23 +10:00
parent add16ab26e
commit e355be8ea3
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47

View File

@ -194,14 +194,13 @@ export const EmbedHandlers: {
if (!metas.image) metas.image = metas.image_fallback;
let image: Required<EmbedImage> | undefined;
if (metas.image && (!metas.width || !metas.height)) {
const result = await probe(metas.image);
image = makeEmbedImage(metas.image, result.width, result.height);
metas.width = result.width;
metas.height = result.height;
}
if (!image && (!metas.title || !metas.description)) {
if (!metas.image && (!metas.title || !metas.description)) {
// we don't have any content to display
return null;
}
@ -215,7 +214,7 @@ export const EmbedHandlers: {
url: url.href,
type: embedType,
title: metas.title,
thumbnail: image,
thumbnail: makeEmbedImage(metas.image, metas.width, metas.height),
description: metas.description,
};
},