From 804322aab0a91b60917296129e3ea47efe37cb64 Mon Sep 17 00:00:00 2001
From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com>
Date: Fri, 9 Dec 2022 09:42:25 +0000
Subject: [PATCH] Updated new actions dist files

---
 dist/restore-only/index.js | 31 ++++++++++++++++++++++++++-----
 dist/save-only/index.js    | 31 ++++++++++++++++++++++++++-----
 2 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js
index 87599b9..ffd5677 100644
--- a/dist/restore-only/index.js
+++ b/dist/restore-only/index.js
@@ -47167,6 +47167,7 @@ const path = __importStar(__webpack_require__(622));
 const utils = __importStar(__webpack_require__(15));
 const cacheHttpClient = __importStar(__webpack_require__(114));
 const tar_1 = __webpack_require__(434);
+const constants_1 = __webpack_require__(931);
 class ValidationError extends Error {
     constructor(message) {
         super(message);
@@ -47228,13 +47229,33 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
         for (const key of keys) {
             checkKey(key);
         }
-        const compressionMethod = yield utils.getCompressionMethod();
+        let cacheEntry;
+        let compressionMethod = yield utils.getCompressionMethod();
         let archivePath = '';
         try {
-            // path are needed to compute version
-            const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
-                compressionMethod
-            });
+            try {
+                // path are needed to compute version
+                cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
+                    compressionMethod
+                });
+            }
+            catch (error) {
+                // This is to support the old cache entry created
+                // by the old version of the cache action on windows.
+                if (process.platform === 'win32' &&
+                    compressionMethod !== constants_1.CompressionMethod.Gzip) {
+                    compressionMethod = constants_1.CompressionMethod.Gzip;
+                    cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
+                        compressionMethod
+                    });
+                    if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
+                        throw error;
+                    }
+                }
+                else {
+                    throw error;
+                }
+            }
             if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
                 // Cache not found
                 return undefined;
diff --git a/dist/save-only/index.js b/dist/save-only/index.js
index 14ad350..44bc3ad 100644
--- a/dist/save-only/index.js
+++ b/dist/save-only/index.js
@@ -47251,6 +47251,7 @@ const path = __importStar(__webpack_require__(622));
 const utils = __importStar(__webpack_require__(15));
 const cacheHttpClient = __importStar(__webpack_require__(114));
 const tar_1 = __webpack_require__(434);
+const constants_1 = __webpack_require__(931);
 class ValidationError extends Error {
     constructor(message) {
         super(message);
@@ -47312,13 +47313,33 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
         for (const key of keys) {
             checkKey(key);
         }
-        const compressionMethod = yield utils.getCompressionMethod();
+        let cacheEntry;
+        let compressionMethod = yield utils.getCompressionMethod();
         let archivePath = '';
         try {
-            // path are needed to compute version
-            const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
-                compressionMethod
-            });
+            try {
+                // path are needed to compute version
+                cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
+                    compressionMethod
+                });
+            }
+            catch (error) {
+                // This is to support the old cache entry created
+                // by the old version of the cache action on windows.
+                if (process.platform === 'win32' &&
+                    compressionMethod !== constants_1.CompressionMethod.Gzip) {
+                    compressionMethod = constants_1.CompressionMethod.Gzip;
+                    cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
+                        compressionMethod
+                    });
+                    if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
+                        throw error;
+                    }
+                }
+                else {
+                    throw error;
+                }
+            }
             if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
                 // Cache not found
                 return undefined;