From 6bef66f0d09e1bc8219aa8eb739af4f1bcdf2ae0 Mon Sep 17 00:00:00 2001 From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:55:36 -0500 Subject: [PATCH] Add try...catch statement to getLicenseUrl() --- .../frontend/shared/views/LicenseDropdown.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contentcuration/contentcuration/frontend/shared/views/LicenseDropdown.vue b/contentcuration/contentcuration/frontend/shared/views/LicenseDropdown.vue index d70ffff150..5c48b116ad 100644 --- a/contentcuration/contentcuration/frontend/shared/views/LicenseDropdown.vue +++ b/contentcuration/contentcuration/frontend/shared/views/LicenseDropdown.vue @@ -225,10 +225,16 @@ this.showAboutLicense = !this.showAboutLicense; }, getLicenseUrl(license) { - const url = new URL(license.license_url); - const isCC = allowedHosts.includes(url.hostname); + const { license_url } = license; const language = window.languageCode || 'en'; - return isCC ? `${license.license_url}deed.${language}` : license.license_url; + try { + const url = new URL(license_url); + return allowedHosts.includes(url.hostname) + ? `${license_url}deed.${language}` + : license_url; + } catch { + return license_url; + } }, }, $trs: {