Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/M1000_IOPackageJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
13 changes: 2 additions & 11 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -126,7 +121,6 @@ function initAxios(context) {
error => Promise.reject(redactAxiosError(error)),
);

axiosInstance = instance;
context.axios = instance;
return context;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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`);
Expand Down
Loading