mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
fix null error in url previewer
This commit is contained in:
@ -17,7 +17,7 @@ const UrlPreviewer = async ({
|
|||||||
|
|
||||||
const metadata = await urlMeta(url);
|
const metadata = await urlMeta(url);
|
||||||
const imageUrl =
|
const imageUrl =
|
||||||
metadata.links.find((v) => v.type.startsWith('image/'))?.href ?? '';
|
metadata?.links?.find((v) => v.type.startsWith('image/'))?.href ?? '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a href={url} target="_blank" className={clsx(className, 'block')}>
|
<a href={url} target="_blank" className={clsx(className, 'block')}>
|
||||||
@ -37,7 +37,7 @@ const UrlPreviewer = async ({
|
|||||||
/>
|
/>
|
||||||
<div className="py-4 px-5 md:p-7 overflow-hidden">
|
<div className="py-4 px-5 md:p-7 overflow-hidden">
|
||||||
<div className={clsx('text-xl mb-1 font-semibold')}>
|
<div className={clsx('text-xl mb-1 font-semibold')}>
|
||||||
{metadata.meta.title}
|
{metadata.meta?.title}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@ -45,7 +45,7 @@ const UrlPreviewer = async ({
|
|||||||
'mb-1',
|
'mb-1',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{metadata.meta.description}
|
{metadata.meta?.description}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
|
Reference in New Issue
Block a user