From 7a3388e3d17560d3e376e57361dd78b8c7fdf8e9 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Tue, 28 Nov 2023 10:36:46 -0800 Subject: [PATCH] fix: error loading scaleway template URL --- src/constants/pinning.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/constants/pinning.js b/src/constants/pinning.js index 7d13134fc..128836b85 100644 --- a/src/constants/pinning.js +++ b/src/constants/pinning.js @@ -57,10 +57,15 @@ const pinningServiceTemplates = [ visitServiceUrl: 'https://www.scaleway.com/en/docs/labs/ipfs/api-cli/ipfs-desktop/' } ].map((service) => { - const domain = new URL(service.apiEndpoint).hostname - service.complianceReportUrl = `${complianceReportsHomepage}/${domain}.html` - return service -}).map(service => ({ service, sort: Math.random() })).sort((a, b) => a.sort - b.sort).map(({ service }) => service) + try { + const domain = new URL(service.apiEndpoint).hostname + service.complianceReportUrl = `${complianceReportsHomepage}/${domain}.html` + } catch (e) { + // if apiEndpoint is not a valid URL, don't add complianceReportUrl + // TODO: fix support for template apiEndpoints + } + return { service, sort: Math.random() } +}).sort((a, b) => a.sort - b.sort).map(({ service }) => service) export { complianceReportsHomepage,