Skip to content

Commit

Permalink
Add try...catch statement to getLicenseUrl()
Browse files Browse the repository at this point in the history
  • Loading branch information
LianaHarris360 committed Sep 13, 2024
1 parent ed09ee7 commit 6bef66f
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 6bef66f

Please sign in to comment.