TASK22224: larger parity bundle for reps and upload handlers

This commit is contained in:
2026-03-23 18:03:59 +00:00
parent 3f5006a744
commit 9f5ec6f50a
4 changed files with 163 additions and 54 deletions
+23 -23
View File
@@ -33,7 +33,6 @@ import {
downloadAllRepsFiles,
getRepsBlobs
} from "../../../actions/azurestorage";
import _ from "lodash";
import nextConnect from "next-connect";
import middleware from "../middleware/middleware";
import { hashAPIPath } from "../../../actions/core/hash";
@@ -44,10 +43,8 @@ const ApiProxy = nextConnect();
ApiProxy.use(middleware);
ApiProxy.get(async (req, res) => {
var containerName = req.query.container;
var casefolderID = req.query.casefolderID;
var checkHash = req.query.hash;
const containerName = req.query.container;
const checkHash = req.query.hash;
if (
typeof containerName === "undefined" ||
@@ -62,9 +59,16 @@ ApiProxy.get(async (req, res) => {
});
}
var checkquerypath = "/api/file/getrepsblob?container=" + containerName;
const hashCandidatePaths = [
"/api/file/getrepsblob?container=" + containerName,
"/api/file/getrepsblob?container=" + encodeURIComponent(containerName)
];
if (hashAPIPath(checkquerypath) != "&hash=" + checkHash) {
const isHashValid = hashCandidatePaths.some(
(candidatePath) => hashAPIPath(candidatePath) == "&hash=" + checkHash
);
if (!isHashValid) {
return respondError(res, {
status: 400,
code: "INVALID_HASH",
@@ -72,23 +76,19 @@ ApiProxy.get(async (req, res) => {
});
}
const blobObj = await getRepsBlobs(containerName)
.then(async (data) => {
return data;
})
.then(async (data) => {
let result = await downloadAllRepsFiles(containerName, data);
res.setHeader("Cache-Control", "no-store");
return respondSuccess(res, result);
})
.catch((error) => {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "GET_REPS_BLOB_FAILED",
message: "Failed to retrieve representation blobs"
});
try {
const repsBlobs = await getRepsBlobs(containerName);
const result = await downloadAllRepsFiles(containerName, repsBlobs);
res.setHeader("Cache-Control", "no-store");
return respondSuccess(res, result);
} catch (error) {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "GET_REPS_BLOB_FAILED",
message: "Failed to retrieve representation blobs"
});
}
});
export default ApiProxy;