From 2b03c2c9defaf217ac022102254aa5f00fa998e7 Mon Sep 17 00:00:00 2001 From: Gabriel-Ladzaretti <97394622+Gabriel-Ladzaretti@users.noreply.github.com> Date: Tue, 12 Mar 2024 12:45:32 +0200 Subject: [PATCH] fix(merge-confidence): escape all slashes within a package name (#27873) --- lib/util/merge-confidence/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/util/merge-confidence/index.ts b/lib/util/merge-confidence/index.ts index 56f2f177a5..26be764a89 100644 --- a/lib/util/merge-confidence/index.ts +++ b/lib/util/merge-confidence/index.ts @@ -7,6 +7,7 @@ import * as packageCache from '../cache/package'; import { parseJson } from '../common'; import * as hostRules from '../host-rules'; import { Http } from '../http'; +import { regEx } from '../regex'; import { ensureTrailingSlash, joinUrlParts } from '../url'; import { MERGE_CONFIDENCE } from './common'; import type { MergeConfidence } from './types'; @@ -164,7 +165,7 @@ async function queryApi( return 'neutral'; } - const escapedPackageName = packageName.replace('/', '%2f'); + const escapedPackageName = packageName.replace(regEx(/\//g), '%2f'); const url = joinUrlParts( apiBaseUrl, 'api/mc/json', -- GitLab