From 7c8bad58f221f302fef134beb21e7cfec2b2c4bb Mon Sep 17 00:00:00 2001 From: SongJun Date: Wed, 22 Jul 2026 08:35:38 -0400 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=86=85=E9=83=A8=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=9C=8D=E5=8A=A1=E7=9A=84=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- download/dist/index.js | 16 ++++++++++++++-- upload/dist/index.js | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/download/dist/index.js b/download/dist/index.js index 0b08c35..09d8f17 100644 --- a/download/dist/index.js +++ b/download/dist/index.js @@ -2694,9 +2694,21 @@ function getResultsServiceUrl() { if (!resultsUrl) { throw new Error('Unable to get the ACTIONS_RESULTS_URL env variable'); } - return new URL(resultsUrl).origin; + const serviceUrl = new URL(resultsUrl); + if (serviceUrl.protocol === 'https:' && isDockerBridgeIPv4(serviceUrl.hostname)) { + serviceUrl.protocol = 'http:'; + } + return serviceUrl.origin; } exports.getResultsServiceUrl = getResultsServiceUrl; +function isDockerBridgeIPv4(hostname) { + const octets = hostname.split('.').map(Number); + return (octets.length === 4 && + octets.every(octet => Number.isInteger(octet) && octet >= 0 && octet <= 255) && + octets[0] === 172 && + octets[1] >= 16 && + octets[1] <= 31); +} function isGhes() { return false; } @@ -124958,4 +124970,4 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /******/ module.exports = __webpack_exports__; /******/ /******/ })() -; \ No newline at end of file +; diff --git a/upload/dist/index.js b/upload/dist/index.js index 1acca9b..30783f1 100644 --- a/upload/dist/index.js +++ b/upload/dist/index.js @@ -3019,9 +3019,21 @@ function getResultsServiceUrl() { if (!resultsUrl) { throw new Error('Unable to get the ACTIONS_RESULTS_URL env variable'); } - return new URL(resultsUrl).origin; + const serviceUrl = new URL(resultsUrl); + if (serviceUrl.protocol === 'https:' && isDockerBridgeIPv4(serviceUrl.hostname)) { + serviceUrl.protocol = 'http:'; + } + return serviceUrl.origin; } exports.getResultsServiceUrl = getResultsServiceUrl; +function isDockerBridgeIPv4(hostname) { + const octets = hostname.split('.').map(Number); + return (octets.length === 4 && + octets.every(octet => Number.isInteger(octet) && octet >= 0 && octet <= 255) && + octets[0] === 172 && + octets[1] >= 16 && + octets[1] <= 31); +} function isGhes() { return false; } @@ -129412,4 +129424,4 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /******/ module.exports = __webpack_exports__; /******/ /******/ })() -; \ No newline at end of file +;