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

This commit is contained in:
shuaiplus
2026-04-25 10:20:30 +08:00
parent 481536ba24
commit 3995e01336
4 changed files with 39 additions and 14 deletions
+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}`);