feat: enhance icon error handling and loading state management in TotpCodesPage and VaultListIcon components

This commit is contained in:
shuaiplus committed 2026-04-25 10:20:30 +08:00
1 parent 481536ba24
commit 3995e01336
4 files changed
+39 -14

No files matched your search

+6 -1
View File
@@ -126,7 +126,12 @@ function buildConfigResponse(origin: string) {
}
function normalizeIconHost(rawHost: string): string | null {
const decoded = decodeURIComponent(String(rawHost || '').trim()).toLowerCase().replace(/\.+$/, '');
let decoded: string;
try {
decoded = decodeURIComponent(String(rawHost || '').trim()).toLowerCase().replace(/\.+$/, '');
} catch {
return null;
}
if (!decoded || decoded.includes('/') || decoded.includes('\\')) return null;
try {
const parsed = new URL(`https://${decoded}`);