From 43cf865a75cc943c09547eb42f7695947fc57a33 Mon Sep 17 00:00:00 2001 From: Ron Ilan Date: Fri, 28 Jun 2024 18:14:40 -0700 Subject: [PATCH] Fix CodeQL errors. --- lib/mock/http.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mock/http.js b/lib/mock/http.js index 9f9bad10..7d4dd0b2 100644 --- a/lib/mock/http.js +++ b/lib/mock/http.js @@ -17,14 +17,14 @@ function http_mock() { const baseHostname = 's3.us-east-1.amazonaws.com'; const basePath = `${os.tmpdir()}/mock`; - nock(new RegExp('^.*' + baseHostname)) + nock(new RegExp('^\.*' + baseHostname)) .persist() .get(() => true) //a function that always returns true is a catch all for nock .reply( (uri) => { const bucket = 'npg-mock-bucket'; const mockDir = uri.indexOf(bucket) === -1 ? `${basePath}/${bucket}` : basePath; - const filepath = path.join(mockDir, uri.replace('%2B', '+')); + const filepath = path.join(mockDir, uri.replace(new RegExp('%2B', 'g'), '+')); try { fs.accessSync(filepath, fs.constants.R_OK);