Skip to content
Open
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
20 changes: 12 additions & 8 deletions dist/restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109850,21 +109850,25 @@ function findObject(mc, bucket, key, restoreKeys, compressionMethod) {
return __awaiter(this, void 0, void 0, function* () {
core.debug("Key: " + JSON.stringify(key));
core.debug("Restore keys: " + JSON.stringify(restoreKeys));
core.debug(`Finding exact macth for: ${key}`);
const exactMatch = yield listObjects(mc, bucket, key);
core.debug(`Found ${JSON.stringify(exactMatch, null, 2)}`);
if (exactMatch.length) {
const result = { item: exactMatch[0], matchingKey: key };
core.debug(`Using ${JSON.stringify(result)}`);
return result;
core.debug(`Finding exact match for: ${key}`);
const keyMatches = yield listObjects(mc, bucket, key);
core.debug(`Found ${JSON.stringify(keyMatches, null, 2)}`);
if (keyMatches.length > 0) {
const exactMatch = keyMatches.find((obj) => obj.name.startsWith(key));
if (exactMatch) {
const result = { item: exactMatch, matchingKey: key };
core.debug(`Found an exact match; using ${JSON.stringify(result)}`);
return result;
}
}
core.debug(`Didn't find an exact match`);
for (const restoreKey of restoreKeys) {
const fn = utils.getCacheFileName(compressionMethod);
core.debug(`Finding object with prefix: ${restoreKey}`);
let objects = yield listObjects(mc, bucket, restoreKey);
objects = objects.filter((o) => o.name.includes(fn));
core.debug(`Found ${JSON.stringify(objects, null, 2)}`);
if (objects.length < 1) {
if (objects.length == 0) {
continue;
}
const sorted = objects.sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime());
Expand Down
20 changes: 12 additions & 8 deletions dist/save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109765,21 +109765,25 @@ function findObject(mc, bucket, key, restoreKeys, compressionMethod) {
return __awaiter(this, void 0, void 0, function* () {
core.debug("Key: " + JSON.stringify(key));
core.debug("Restore keys: " + JSON.stringify(restoreKeys));
core.debug(`Finding exact macth for: ${key}`);
const exactMatch = yield listObjects(mc, bucket, key);
core.debug(`Found ${JSON.stringify(exactMatch, null, 2)}`);
if (exactMatch.length) {
const result = { item: exactMatch[0], matchingKey: key };
core.debug(`Using ${JSON.stringify(result)}`);
return result;
core.debug(`Finding exact match for: ${key}`);
const keyMatches = yield listObjects(mc, bucket, key);
core.debug(`Found ${JSON.stringify(keyMatches, null, 2)}`);
if (keyMatches.length > 0) {
const exactMatch = keyMatches.find((obj) => obj.name.startsWith(key));
if (exactMatch) {
const result = { item: exactMatch, matchingKey: key };
core.debug(`Found an exact match; using ${JSON.stringify(result)}`);
return result;
}
}
core.debug(`Didn't find an exact match`);
for (const restoreKey of restoreKeys) {
const fn = utils.getCacheFileName(compressionMethod);
core.debug(`Finding object with prefix: ${restoreKey}`);
let objects = yield listObjects(mc, bucket, restoreKey);
objects = objects.filter((o) => o.name.includes(fn));
core.debug(`Found ${JSON.stringify(objects, null, 2)}`);
if (objects.length < 1) {
if (objects.length == 0) {
continue;
}
const sorted = objects.sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime());
Expand Down
20 changes: 12 additions & 8 deletions dist/saveOnly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109765,21 +109765,25 @@ function findObject(mc, bucket, key, restoreKeys, compressionMethod) {
return __awaiter(this, void 0, void 0, function* () {
core.debug("Key: " + JSON.stringify(key));
core.debug("Restore keys: " + JSON.stringify(restoreKeys));
core.debug(`Finding exact macth for: ${key}`);
const exactMatch = yield listObjects(mc, bucket, key);
core.debug(`Found ${JSON.stringify(exactMatch, null, 2)}`);
if (exactMatch.length) {
const result = { item: exactMatch[0], matchingKey: key };
core.debug(`Using ${JSON.stringify(result)}`);
return result;
core.debug(`Finding exact match for: ${key}`);
const keyMatches = yield listObjects(mc, bucket, key);
core.debug(`Found ${JSON.stringify(keyMatches, null, 2)}`);
if (keyMatches.length > 0) {
const exactMatch = keyMatches.find((obj) => obj.name.startsWith(key));
if (exactMatch) {
const result = { item: exactMatch, matchingKey: key };
core.debug(`Found an exact match; using ${JSON.stringify(result)}`);
return result;
}
}
core.debug(`Didn't find an exact match`);
for (const restoreKey of restoreKeys) {
const fn = utils.getCacheFileName(compressionMethod);
core.debug(`Finding object with prefix: ${restoreKey}`);
let objects = yield listObjects(mc, bucket, restoreKey);
objects = objects.filter((o) => o.name.includes(fn));
core.debug(`Found ${JSON.stringify(objects, null, 2)}`);
if (objects.length < 1) {
if (objects.length == 0) {
continue;
}
const sorted = objects.sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime());
Expand Down
20 changes: 12 additions & 8 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,26 @@ export async function findObject(
core.debug("Key: " + JSON.stringify(key));
core.debug("Restore keys: " + JSON.stringify(restoreKeys));

core.debug(`Finding exact macth for: ${key}`);
const exactMatch = await listObjects(mc, bucket, key);
core.debug(`Found ${JSON.stringify(exactMatch, null, 2)}`);
if (exactMatch.length) {
const result = { item: exactMatch[0], matchingKey: key };
core.debug(`Using ${JSON.stringify(result)}`);
return result;
core.debug(`Finding exact match for: ${key}`);
const keyMatches = await listObjects(mc, bucket, key);
core.debug(`Found ${JSON.stringify(keyMatches, null, 2)}`);
if (keyMatches.length > 0) {
const exactMatch = keyMatches.find((obj) => obj.name.startsWith(key));
if (exactMatch) {
const result = { item: exactMatch, matchingKey: key };
core.debug(`Found an exact match; using ${JSON.stringify(result)}`);
return result;
}
}
core.debug(`Didn't find an exact match`);

for (const restoreKey of restoreKeys) {
const fn = utils.getCacheFileName(compressionMethod);
core.debug(`Finding object with prefix: ${restoreKey}`);
let objects = await listObjects(mc, bucket, restoreKey);
objects = objects.filter((o) => o.name.includes(fn));
core.debug(`Found ${JSON.stringify(objects, null, 2)}`);
if (objects.length < 1) {
if (objects.length == 0) {
continue;
}
const sorted = objects.sort(
Expand Down