@@ -2328,6 +2328,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
2328
2328
Object.defineProperty(exports, "__esModule", ({ value: true }));
2329
2329
exports.downloadArtifactInternal = exports.downloadArtifactPublic = exports.streamExtractExternal = void 0;
2330
2330
const promises_1 = __importDefault(__nccwpck_require__(73292));
2331
+ const stream = __importStar(__nccwpck_require__(12781));
2332
+ const fs_1 = __nccwpck_require__(57147);
2333
+ const path = __importStar(__nccwpck_require__(71017));
2331
2334
const github = __importStar(__nccwpck_require__(21260));
2332
2335
const core = __importStar(__nccwpck_require__(42186));
2333
2336
const httpClient = __importStar(__nccwpck_require__(96255));
@@ -2368,6 +2371,9 @@ function streamExtract(url, directory) {
2368
2371
return;
2369
2372
}
2370
2373
catch (error) {
2374
+ if (error.message.includes('Malformed extraction path')) {
2375
+ throw new Error(`Artifact download failed with unretryable error: ${error.message}`);
2376
+ }
2371
2377
retryCount++;
2372
2378
core.debug(`Failed to download artifact after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`);
2373
2379
// wait 5 seconds before retrying
@@ -2390,6 +2396,8 @@ function streamExtractExternal(url, directory) {
2390
2396
response.message.destroy(new Error(`Blob storage chunk did not respond in ${timeout}ms`));
2391
2397
};
2392
2398
const timer = setTimeout(timerFn, timeout);
2399
+ const createdDirectories = new Set();
2400
+ createdDirectories.add(directory);
2393
2401
response.message
2394
2402
.on('data', () => {
2395
2403
timer.refresh();
@@ -2399,11 +2407,47 @@ function streamExtractExternal(url, directory) {
2399
2407
clearTimeout(timer);
2400
2408
reject(error);
2401
2409
})
2402
- .pipe(unzip_stream_1.default.Extract({ path: directory }))
2403
- .on('close', () => {
2410
+ .pipe(unzip_stream_1.default.Parse())
2411
+ .pipe(new stream.Transform({
2412
+ objectMode: true,
2413
+ transform: (entry, _, callback) => __awaiter(this, void 0, void 0, function* () {
2414
+ const fullPath = path.normalize(path.join(directory, entry.path));
2415
+ if (!directory.endsWith(path.sep)) {
2416
+ directory += path.sep;
2417
+ }
2418
+ if (!fullPath.startsWith(directory)) {
2419
+ reject(new Error(`Malformed extraction path: ${fullPath}`));
2420
+ }
2421
+ if (entry.type === 'Directory') {
2422
+ if (!createdDirectories.has(fullPath)) {
2423
+ createdDirectories.add(fullPath);
2424
+ yield resolveOrCreateDirectory(fullPath).then(() => {
2425
+ entry.autodrain();
2426
+ callback();
2427
+ });
2428
+ }
2429
+ else {
2430
+ entry.autodrain();
2431
+ callback();
2432
+ }
2433
+ }
2434
+ else {
2435
+ core.info(`Extracting artifact entry: ${fullPath}`);
2436
+ if (!createdDirectories.has(path.dirname(fullPath))) {
2437
+ createdDirectories.add(path.dirname(fullPath));
2438
+ yield resolveOrCreateDirectory(path.dirname(fullPath));
2439
+ }
2440
+ const writeStream = (0, fs_1.createWriteStream)(fullPath);
2441
+ writeStream.on('finish', callback);
2442
+ writeStream.on('error', reject);
2443
+ entry.pipe(writeStream);
2444
+ }
2445
+ })
2446
+ }))
2447
+ .on('finish', () => __awaiter(this, void 0, void 0, function* () {
2404
2448
clearTimeout(timer);
2405
2449
resolve();
2406
- })
2450
+ }))
2407
2451
.on('error', (error) => {
2408
2452
reject(error);
2409
2453
});
@@ -99049,6 +99093,9 @@ function httpRedirectFetch (fetchParams, response) {
99049
99093
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
99050
99094
request.headersList.delete('authorization')
99051
99095
99096
+ // https://fetch.spec.whatwg.org/#authentication-entries
99097
+ request.headersList.delete('proxy-authorization', true)
99098
+
99052
99099
// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
99053
99100
request.headersList.delete('cookie')
99054
99101
request.headersList.delete('host')
@@ -125015,7 +125062,7 @@ exports.unescape = unescape;
125015
125062
/***/ ((module) => {
125016
125063
125017
125064
"use strict";
125018
- module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.1","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^5.3.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}');
125065
+ module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.4","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^5.3.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}');
125019
125066
125020
125067
/***/ }),
125021
125068
0 commit comments