TASK22224: harden getrepsblob against stale tag entries
This commit is contained in:
+18
-5
@@ -1384,14 +1384,27 @@ export const getRepsBlobs = async (containerName) => {
|
||||
listOptions
|
||||
)) {
|
||||
const blobClient = containerClient.getBlobClient(blob.name);
|
||||
//console.log("getreps blob:", blob);
|
||||
blob.name.split("/")[2].indexOf("_rep.json") > 0 &&
|
||||
blob.name.split("/")[2].indexOf("undefined") < 0 &&
|
||||
|
||||
// Filter out soft-deleted/stale tag entries and malformed names.
|
||||
const namePart = blob.name.split("/")[2] ?? "";
|
||||
if (
|
||||
namePart.indexOf("_rep.json") <= 0 ||
|
||||
namePart.indexOf("undefined") >= 0
|
||||
)
|
||||
continue;
|
||||
|
||||
try {
|
||||
const properties = await blobClient.getProperties();
|
||||
|
||||
blobObj.push({
|
||||
"name": blob.name.split("/")[2],
|
||||
"name": namePart,
|
||||
"path": blob.name,
|
||||
"size": blobClient.getProperties().contentLength
|
||||
"size": properties.contentLength
|
||||
});
|
||||
} catch (error) {
|
||||
if (error?.statusCode === 404) continue;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
//console.log("blobObjwwwww:", blobObj);
|
||||
|
||||
Reference in New Issue
Block a user