1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-18 20:59:42 +02:00

fix issue with link preview

This commit is contained in:
Nikita Melnikov 2022-11-07 07:15:19 -03:00
parent 7914a5a0ac
commit 17857c88df
3 changed files with 13 additions and 6 deletions

View file

@ -48,8 +48,14 @@ router.get('/fetchUrl', async (req: Request, res: Response) => {
},
};
if (linkData.ogImage !== undefined) {
response.meta.image = { url: linkData.ogImage.toString() };
const image = linkData.ogImage;
if (image) {
if (Array.isArray(image)) {
response.meta.image = { url: image[0].url };
} else {
response.meta.image = { url: image.url };
}
}
res.status(200).json(response);