Skip to content

Commit 7a3388e

Browse files
committed
fix: error loading scaleway template URL
1 parent 7f377ff commit 7a3388e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/constants/pinning.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ const pinningServiceTemplates = [
5757
visitServiceUrl: 'https://www.scaleway.com/en/docs/labs/ipfs/api-cli/ipfs-desktop/'
5858
}
5959
].map((service) => {
60-
const domain = new URL(service.apiEndpoint).hostname
61-
service.complianceReportUrl = `${complianceReportsHomepage}/${domain}.html`
62-
return service
63-
}).map(service => ({ service, sort: Math.random() })).sort((a, b) => a.sort - b.sort).map(({ service }) => service)
60+
try {
61+
const domain = new URL(service.apiEndpoint).hostname
62+
service.complianceReportUrl = `${complianceReportsHomepage}/${domain}.html`
63+
} catch (e) {
64+
// if apiEndpoint is not a valid URL, don't add complianceReportUrl
65+
// TODO: fix support for template apiEndpoints
66+
}
67+
return { service, sort: Math.random() }
68+
}).sort((a, b) => a.sort - b.sort).map(({ service }) => service)
6469

6570
export {
6671
complianceReportsHomepage,

0 commit comments

Comments
 (0)