diff --git a/src/lib/transformReport.ts b/src/lib/transformReport.ts index 60139aa..2664445 100644 --- a/src/lib/transformReport.ts +++ b/src/lib/transformReport.ts @@ -573,7 +573,7 @@ export function transformApiReport( location: clinic.address || '', nearestStation: '', phone: clinic.phone || '', - domain: new URL(metadata.url).hostname, + domain: (() => { try { return new URL(metadata.url || '').hostname; } catch { return metadata.url || ''; } })(), // Registry-sourced fields source: metadata.source ?? 'scrape', registryData: metadata.registryData ?? undefined, @@ -653,7 +653,7 @@ export function transformApiReport( ], websiteAudit: { - primaryDomain: new URL(metadata.url).hostname, + primaryDomain: (() => { try { return new URL(metadata.url || '').hostname; } catch { return metadata.url || ''; } })(), additionalDomains: (r.channelAnalysis?.website?.additionalDomains || []).map(d => ({ domain: (d as { domain?: string }).domain || '', purpose: (d as { purpose?: string }).purpose || '', diff --git a/src/pages/ClinicProfilePage.tsx b/src/pages/ClinicProfilePage.tsx index ee1fb88..adbaea5 100644 --- a/src/pages/ClinicProfilePage.tsx +++ b/src/pages/ClinicProfilePage.tsx @@ -137,7 +137,7 @@ export default function ClinicProfilePage() { CLINIC.nameEn = (row.clinic_name || '').includes('의원') ? '' : row.clinic_name || ''; // Update website - const domain = new URL(row.url).hostname; + const domain = (() => { try { return new URL(row.url || '').hostname; } catch { return row.url || ''; } })(); CLINIC.websites = [{ label: '공식 홈페이지', url: domain, primary: true }]; // Update social from socialHandles