diff --git a/scripts/badge-cli.js b/scripts/badge-cli.js index 77d088d3e176fb7c548b35676979a281273a3f81..7fd060e6e801be19fd59eae864abb0cf972e89a5 100644 --- a/scripts/badge-cli.js +++ b/scripts/badge-cli.js @@ -10,7 +10,10 @@ const trace = require('../core/base-service/trace') function normalizeBadgeUrl(url) { // Provide a base URL in order to accept fragments. const { pathname, searchParams } = new URL(url, 'http://example.com') - const newPath = pathname.replace('.svg', '.json') + let newPath = pathname.replace('.svg', '') + if (!newPath.endsWith('.json')) { + newPath = `${newPath}.json` + } return `${newPath}?${searchParams.toString()}` }