diff --git a/lib/M1000_IOPackageJson.js b/lib/M1000_IOPackageJson.js index d0d0534..2b2f0ba 100644 --- a/lib/M1000_IOPackageJson.js +++ b/lib/M1000_IOPackageJson.js @@ -1680,7 +1680,7 @@ async function checkIOPackageJson(context) { try { if (common.isLocal()) { const url = context.ioPackageJson.common.extIcon.replace(context.githubUrl, ''); - icon = await common.getFile(null, url, true); // TO BE ADAPTED + icon = await common.getFile(context, url, true); } else { icon = await common.downloadURL(context, context.ioPackageJson.common.extIcon, true); } diff --git a/lib/common.js b/lib/common.js index 7834ec9..a6fc8fe 100644 --- a/lib/common.js +++ b/lib/common.js @@ -11,11 +11,6 @@ const semverValid = require('semver/functions/valid'); const githubToken = process.env.OWN_GITHUB_TOKEN; const redactedValue = '***REDACTED***'; -// Fallback axios instance – set by the most recent initAxios() call. -// Prefer context.axios (set per check) over this module-level fallback so that -// concurrent checks do not share the same authorized instance. -let axiosInstance = null; - // All github tokens ever registered across all initAxios() calls, used so that // redactString() redacts every token regardless of which check is currently active. const knownTokens = new Set(); @@ -126,7 +121,6 @@ function initAxios(context) { error => Promise.reject(redactAxiosError(error)), ); - axiosInstance = instance; context.axios = instance; return context; } @@ -311,9 +305,7 @@ async function downloadURL(context, url, binary) { debug(`Download file ${url} ${binary ? ' using binary mode' : ''})`); const options = {}; options.responseType = binary ? 'arraybuffer' : 'text'; - // Use the per-check axios instance from context when available so that concurrent - // checks do not share the same authorized instance (see issue #1193). - const instance = (context && context.axios) || axiosInstance; + const instance = context.axios; try { // @ts-expect-error options work this way const response = await instance(url, options); @@ -369,8 +361,7 @@ async function getFilesList(context) { const url = `https://data.jsdelivr.com/v1/packages/gh/${context.repository}@${context.lastCommitSha}?structure=flat`; debug(`Download ${url}`); const filesList = []; - // Use the per-check axios instance so concurrent checks stay isolated (see issue #1193). - const instance = context.axios || axiosInstance; + const instance = context.axios; try { const response = await instance(url); debug(`download succeded`);