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
+18 -21
View File
@@ -1,8 +1,4 @@
import {
createBlob,
createRepBlob,
uploadFile
} from "../../../actions/azurestorage";
import { createBlob, createRepBlob } from "../../../actions/azurestorage";
import { hashAPIPath } from "../../../actions/core/hash";
import { respondError, respondSuccess } from "../middleware/apiResponse";
@@ -13,7 +9,7 @@ const ApiProxy = nextConnect();
ApiProxy.use(middleware);
ApiProxy.post(async (req, res) => {
var checkHash = req.query.hash;
const checkHash = req.query.hash;
if (typeof checkHash === "undefined" || checkHash.length === 0) {
return respondError(res, {
@@ -23,9 +19,12 @@ ApiProxy.post(async (req, res) => {
});
}
var checkquerypath = "/api/file/upload";
const hashCandidatePaths = ["/api/file/upload", "/api/file/upload?"];
const isHashValid = hashCandidatePaths.some(
(candidatePath) => hashAPIPath(candidatePath) == "?hash=" + checkHash
);
if (hashAPIPath(checkquerypath) != "?hash=" + checkHash) {
if (!isHashValid) {
return respondError(res, {
status: 400,
code: "INVALID_HASH",
@@ -51,21 +50,19 @@ ApiProxy.post(async (req, res) => {
});
}
return (
repOrAppeal
try {
const data = await (repOrAppeal
? createRepBlob(appealData, containerID, casefolderID)
: createBlob(appealData, containerID, casefolderID)
)
.then((data) => {
return respondSuccess(res, { data });
})
.catch(() => {
return respondError(res, {
status: 400,
code: "UPLOAD_FAILED",
message: "Failed to upload blob"
});
: createBlob(appealData, containerID, casefolderID));
return respondSuccess(res, { data });
} catch {
return respondError(res, {
status: 400,
code: "UPLOAD_FAILED",
message: "Failed to upload blob"
});
}
});
export const config = {