Update profile picture URL and add error handling in EntryPage

This commit is contained in:
2026-01-07 23:27:19 +01:00
parent 7657810193
commit 188c9b656a

View File

@@ -74,7 +74,17 @@ export default function EntryPage() {
<div className="ig-block"> <div className="ig-block">
{ig.profile_pic_url ? ( {ig.profile_pic_url ? (
<a href={profileUrl || '#'} target="_blank" rel="noreferrer"> <a href={profileUrl || '#'} target="_blank" rel="noreferrer">
<img className="ig-avatar" src={ig.profile_pic_url} alt={ig.username || 'profile'} /> <img
className="ig-avatar"
src={`/api/profile-pic?id=${encodeURIComponent(entry.id)}`}
alt={ig.username || 'profile'}
onError={(e) => {
if (ig.profile_pic_url && !e.currentTarget.dataset.fallback) {
e.currentTarget.dataset.fallback = '1';
e.currentTarget.src = ig.profile_pic_url;
}
}}
/>
</a> </a>
) : ( ) : (
<div className="ig-avatar placeholder" /> <div className="ig-avatar placeholder" />