From e7376ac1b8609987c99e5ff4f1b151a6ac63f4a4 Mon Sep 17 00:00:00 2001 From: aaniya22 Date: Wed, 29 Jul 2026 03:39:04 +0530 Subject: [PATCH] fix: enable next/image optimization in ProfileCard (#2546) Removed unoptimized flag and allowlisted images.unsplash.com in remotePatterns and CSP img-src for the fallback avatar. Signed-off-by: aaniya22 --- next.config.mjs | 8 +++-- src/components/ProfileCard.tsx | 58 ++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 8c1b8f370..3dcdf322a 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -111,7 +111,7 @@ const withPWA = withPWAInit({ return ( url.pathname.startsWith("/_next/static/") || /\.(?:js|css|woff2?|png|jpg|jpeg|gif|svg|ico|webp|json)$/.test( - url.pathname, + url.pathname ) ); }, @@ -149,6 +149,10 @@ const nextConfig = { protocol: "https", hostname: "via.placeholder.com", }, + { + protocol: "https", + hostname: "images.unsplash.com", + }, ], }, async headers() { @@ -187,7 +191,7 @@ const nextConfig = { "script-src 'self' 'unsafe-eval' 'unsafe-inline'", "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com", "font-src 'self' https://fonts.gstatic.com", - "img-src 'self' data: blob: https://avatars.githubusercontent.com https://github.githubassets.com", + "img-src 'self' data: blob: https://avatars.githubusercontent.com https://github.githubassets.com https://images.unsplash.com", "connect-src 'self' https://api.github.com https://groq.com https://api.groq.com https://*.supabase.co wss://*.supabase.co https://*.upstash.io", "frame-ancestors 'none'", "base-uri 'none'", diff --git a/src/components/ProfileCard.tsx b/src/components/ProfileCard.tsx index 52851eb52..085df0c3a 100644 --- a/src/components/ProfileCard.tsx +++ b/src/components/ProfileCard.tsx @@ -4,7 +4,6 @@ import Link from "next/link"; import "./ProfileCard.css"; import Image from "next/image"; - export type SocialLink = { href: string; label?: string; @@ -34,16 +33,21 @@ export default function ProfileCard({ const displayBio = bio?.trim() ?? ""; return ( -