From c87e13cb70da083ffb67527bebd06bfc1d988497 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 1 May 2022 22:27:21 +0100 Subject: [PATCH] :goal_net: Catch error if URL not specificed --- src/components/LinkItems/ItemIcon.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/LinkItems/ItemIcon.vue b/src/components/LinkItems/ItemIcon.vue index 65b1bafa..97c231cf 100644 --- a/src/components/LinkItems/ItemIcon.vue +++ b/src/components/LinkItems/ItemIcon.vue @@ -142,12 +142,13 @@ export default { }, /* Get favicon URL, for items which use the favicon as their icon */ getFavicon(fullUrl, specificApi) { + const fullUrlTrue = fullUrl || ''; const faviconApi = specificApi || this.appConfig.faviconApi || defaultFaviconApi; - if (this.shouldUseDefaultFavicon(fullUrl) || faviconApi === 'local') { // Check if we should use local icon - const urlParts = fullUrl.split('/'); + if (this.shouldUseDefaultFavicon(fullUrlTrue) || faviconApi === 'local') { // Check if we should use local icon + const urlParts = fullUrlTrue.split('/'); if (urlParts.length >= 2) return `${urlParts[0]}/${urlParts[1]}/${urlParts[2]}/${iconCdns.faviconName}`; - } else if (fullUrl.includes('http')) { // Service is running publicly - const host = this.getHostName(fullUrl); + } else if (fullUrlTrue.includes('http')) { // Service is running publicly + const host = this.getHostName(fullUrlTrue); const endpoint = faviconApiEndpoints[faviconApi]; return endpoint.replace('$URL', host); } @@ -223,7 +224,7 @@ export default { /* Called when initial icon has resulted in 404. Attempts to find new icon */ getFallbackIcon() { if (this.attemptedFallback) return undefined; // If this is second attempt, then give up - const { iconType } = this; + const iconType = this.iconType || ''; const markAsAttempted = () => { this.broken = false; this.attemptedFallback = true; }; if (iconType.includes('favicon')) { // Specify fallback for favicon-based icons markAsAttempted();