@@ -125,9 +125,11 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
125125 // Internal Error
126126 return undefined;
127127 }
128+ core.debug(`Cache Entry: ${JSON.stringify(cacheEntry)}`);
128129 archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
129130 core.debug(`Archive Path: ${archivePath}`);
130131 const cacheKey = (_b = (_a = cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cache_entry) === null || _a === void 0 ? void 0 : _a.cache_user_given_key) !== null && _b !== void 0 ? _b : primaryKey;
132+ core.debug(`Cache Key: ${cacheKey}`);
131133 switch (cacheEntry.provider) {
132134 case 's3':
133135 case 'r2': {
@@ -142,7 +144,8 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
142144 yield cacheHttpClient.downloadCache('s3', (_d = cacheEntry.s3) === null || _d === void 0 ? void 0 : _d.pre_signed_url, archivePath);
143145 }
144146 catch (error) {
145- core.info('Cache Miss. Failed to download cache.');
147+ core.debug(`Failed to download cache: ${error}`);
148+ core.info(`Cache Miss. Failed to download cache from ${cacheEntry.provider}. Error: ${error}`);
146149 return undefined;
147150 }
148151 if (core.isDebug()) {
@@ -1451,10 +1454,17 @@ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options
14511454 keepAlive: true
14521455 });
14531456 try {
1454- const res = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCacheMetadata', () => __awaiter(this, void 0, void 0, function* () { return yield httpClient.request('HEAD', archiveLocation, null, {}); }));
1455- const lengthHeader = res.message.headers['content-length'];
1456- if (lengthHeader === undefined || lengthHeader === null) {
1457- throw new Error('Content-Length not found on blob response');
1457+ // Use Range request to get total file size (works with PresignGetObject URLs)
1458+ const res = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCacheMetadata', () => __awaiter(this, void 0, void 0, function* () { return yield httpClient.get(archiveLocation, { Range: 'bytes=0-0' }); }));
1459+ const contentRange = res.message.headers['content-range'];
1460+ if (!contentRange) {
1461+ throw new Error('Content-Range header not found - server may not support range requests');
1462+ }
1463+ // Parse "bytes 0-0/12345" to get total length (12345)
1464+ const match = contentRange.match(/bytes \d+-\d+\/(\d+)/);
1465+ const lengthHeader = match === null || match === void 0 ? void 0 : match[1];
1466+ if (!lengthHeader) {
1467+ throw new Error('Could not parse total file size from Content-Range header');
14581468 }
14591469 const length = parseInt(lengthHeader);
14601470 if (Number.isNaN(length)) {
@@ -1498,6 +1508,7 @@ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options
14981508 while (actives > 0) {
14991509 yield waitAndWrite();
15001510 }
1511+ progress.stopDisplayTimer();
15011512 }
15021513 finally {
15031514 httpClient.dispose();
0 commit comments