fix: URL 파싱 에러 방어 처리 (transformReport, ClinicProfilePage)

metadata.url 또는 row.url이 null/빈 문자열일 때
new URL() 호출이 throw하던 문제를 try/catch로 방어.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude/bold-hawking
Haewon Kam 2026-04-10 15:31:56 +09:00
parent 742c0f1bcc
commit 2a1a6f20fb
2 changed files with 3 additions and 3 deletions

View File

@ -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 || '',

View File

@ -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