TASK22224: harden awaiting-submission blob retrieval contract
This commit is contained in:
@@ -12,8 +12,8 @@ const ApiProxy = nextConnect();
|
||||
ApiProxy.use(middleware);
|
||||
|
||||
ApiProxy.get(async (req, res) => {
|
||||
var containerName = req.query.container;
|
||||
var checkHash = req.query.hash;
|
||||
const containerName = req.query.container;
|
||||
const checkHash = req.query.hash;
|
||||
|
||||
if (
|
||||
typeof containerName === "undefined" ||
|
||||
@@ -28,7 +28,7 @@ ApiProxy.get(async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
var checkquerypath =
|
||||
const checkquerypath =
|
||||
"/api/file/getawaitingsubmissionfromblob?container=" + containerName;
|
||||
|
||||
if (hashAPIPath(checkquerypath) != "&hash=" + checkHash) {
|
||||
@@ -39,13 +39,20 @@ ApiProxy.get(async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
const blobObj = await getAllProgressBlobs(containerName)
|
||||
.then((data) => {
|
||||
return downloadAllProgressFiles(containerName, data);
|
||||
})
|
||||
.then((data) => {
|
||||
return respondSuccess(res, data);
|
||||
try {
|
||||
const progressBlobs = await getAllProgressBlobs(containerName);
|
||||
const data = await downloadAllProgressFiles(
|
||||
containerName,
|
||||
progressBlobs
|
||||
);
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "GET_AWAITING_SUBMISSION_BLOB_FAILED",
|
||||
message: "Failed to retrieve awaiting submission blobs"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const config = {
|
||||
|
||||
Reference in New Issue
Block a user