TASK22269: tidy azurestorage blob path split locals

This commit is contained in:
2026-03-26 11:13:48 +00:00
parent 58e1eef1f5
commit 9791270670
2 changed files with 54 additions and 24 deletions
+23 -24
View File
@@ -267,16 +267,16 @@ export const getBlobs = async (containerName, casefolderID) => {
for await (const blob of containerClient.listBlobsFlat({
prefix: casefolderID + "/files/"
})) {
const blobPathParts = blob.name.split("/");
const fileName = blobPathParts[2];
let blobDocumentType = blob.name
.split("/")[2]
.slice(0, blob.name.split("/")[2].indexOf("_"));
blobObj.push({
"name": blob.name.split("/")[2],
"name": fileName,
"path": blob.name,
"documentType": getDocumentTypeFromFilename(
blob.name.split("/")[2]
),
"documentType": getDocumentTypeFromFilename(fileName),
"versionId": blob.versionId,
"caseObj": casefolderID + "/" + casefolderID + "_case.json",
"isCurrentVersion": blob.isCurrentVersion,
@@ -294,7 +294,7 @@ export const getBlobs = async (containerName, casefolderID) => {
...buildHashMetadataPaths({
containerName,
casefolderID,
blobname: blob.name.split("/")[2]
blobname: fileName
}),
"deletepath":
"/api/file/deleteblob?container=" +
@@ -302,7 +302,7 @@ export const getBlobs = async (containerName, casefolderID) => {
"&casefolderID=" +
encodeURIComponent(casefolderID) +
"&blobname=" +
encodeURIComponent(blob.name.split("/")[2])
encodeURIComponent(fileName)
});
}
//console.log("blobObj:", blobObj);
@@ -1296,9 +1296,12 @@ export const getProgressBlobs = async (containerName, caseReference) => {
for await (const blob of containerClient.listBlobsFlat({
prefix: caseReference + "/" + caseReference + "_appeal.json"
})) {
console.log("getProgressBlobs in here", blob.name.split("/"));
const blobPathParts = blob.name.split("/");
const appealBlobName = blobPathParts[1];
console.log("getProgressBlobs in here", blobPathParts);
blobObj.push({
"name": blob.name.split("/")[1],
"name": appealBlobName,
"path": blob.name,
"versionId": blob.versionId,
"caseObj": caseReference + "/" + caseReference + "_case.json",
@@ -1309,7 +1312,7 @@ export const getProgressBlobs = async (containerName, caseReference) => {
...buildHashMetadataPaths({
containerName,
casefolderID: caseReference,
blobname: blob.name.split("/")[1]
blobname: appealBlobName
})
});
}
@@ -1473,6 +1476,9 @@ export const getRepsFilesBlobs = async (
for await (const blob of containerClient.listBlobsFlat({
prefix: casefolderID + "/" + filenamePrefix + "/files/"
})) {
const blobPathParts = blob.name.split("/");
const casefolderPath = blobPathParts[0] + "/" + blobPathParts[1];
const repFileName = blobPathParts[3];
let blobDocumentType = blob.name
.split("/")[2]
.slice(0, blob.name.split("/")[2].indexOf("_"));
@@ -1480,11 +1486,9 @@ export const getRepsFilesBlobs = async (
console.log(blob.name);
blobObj.push({
"name": blob.name.split("/")[3],
"name": repFileName,
"path": blob.name,
"documentType": getDocumentTypeFromFilename(
blob.name.split("/")[3]
),
"documentType": getDocumentTypeFromFilename(repFileName),
"versionId": blob.versionId,
"isCurrentVersion": blob.isCurrentVersion,
"contentLength": blob.properties.contentLength,
@@ -1493,26 +1497,21 @@ export const getRepsFilesBlobs = async (
"/api/file/downloadblob?container=" +
containerName +
"&casefolderID=" +
encodeURIComponent(
blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
) +
encodeURIComponent(casefolderPath) +
"&blobname=" +
encodeURIComponent(blob.name.split("/")[3]),
encodeURIComponent(repFileName),
...buildHashMetadataPaths({
containerName,
casefolderID:
blob.name.split("/")[0] + "/" + blob.name.split("/")[1],
blobname: blob.name.split("/")[3]
casefolderID: casefolderPath,
blobname: repFileName
}),
"deletepath":
"/api/file/deleteblob?container=" +
containerName +
"&casefolderID=" +
blob.name.split("/")[0] +
"/" +
blob.name.split("/")[1] +
casefolderPath +
"&blobname=" +
blob.name.split("/")[3]
repFileName
});
}
console.log("blobObj:", blobObj);