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
parent
742c0f1bcc
commit
2a1a6f20fb
|
|
@ -573,7 +573,7 @@ export function transformApiReport(
|
||||||
location: clinic.address || '',
|
location: clinic.address || '',
|
||||||
nearestStation: '',
|
nearestStation: '',
|
||||||
phone: clinic.phone || '',
|
phone: clinic.phone || '',
|
||||||
domain: new URL(metadata.url).hostname,
|
domain: (() => { try { return new URL(metadata.url || '').hostname; } catch { return metadata.url || ''; } })(),
|
||||||
// Registry-sourced fields
|
// Registry-sourced fields
|
||||||
source: metadata.source ?? 'scrape',
|
source: metadata.source ?? 'scrape',
|
||||||
registryData: metadata.registryData ?? undefined,
|
registryData: metadata.registryData ?? undefined,
|
||||||
|
|
@ -653,7 +653,7 @@ export function transformApiReport(
|
||||||
],
|
],
|
||||||
|
|
||||||
websiteAudit: {
|
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 => ({
|
additionalDomains: (r.channelAnalysis?.website?.additionalDomains || []).map(d => ({
|
||||||
domain: (d as { domain?: string }).domain || '',
|
domain: (d as { domain?: string }).domain || '',
|
||||||
purpose: (d as { purpose?: string }).purpose || '',
|
purpose: (d as { purpose?: string }).purpose || '',
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ export default function ClinicProfilePage() {
|
||||||
CLINIC.nameEn = (row.clinic_name || '').includes('의원') ? '' : row.clinic_name || '';
|
CLINIC.nameEn = (row.clinic_name || '').includes('의원') ? '' : row.clinic_name || '';
|
||||||
|
|
||||||
// Update website
|
// 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 }];
|
CLINIC.websites = [{ label: '공식 홈페이지', url: domain, primary: true }];
|
||||||
|
|
||||||
// Update social from socialHandles
|
// Update social from socialHandles
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue