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:
parent
7914a5a0ac
commit
17857c88df
3 changed files with 13 additions and 6 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue