From 3a19a2f4e5a48d8c7deb424490f1395ef8b44c91 Mon Sep 17 00:00:00 2001 From: chris48s <chris48s@users.noreply.github.com> Date: Sat, 4 Apr 2020 19:57:27 +0100 Subject: [PATCH] fix badge CLI debug script (#4865) Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> --- scripts/badge-cli.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/badge-cli.js b/scripts/badge-cli.js index 77d088d3e1..7fd060e6e8 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()}` } -- GitLab