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
+12 -10
View File
@@ -1,8 +1,4 @@
import {
createBlob,
createRepBlob,
uploadSingleFile
} from "../../../actions/azurestorage";
import { uploadSingleFile } from "../../../actions/azurestorage";
import nextConnect from "next-connect";
import middleware from "../middleware/middleware";
@@ -37,7 +33,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, {
@@ -47,9 +43,15 @@ ApiProxy.post(async (req, res) => {
});
}
var checkquerypath = "/api/file/uploadsinglefile";
const hashCandidatePaths = [
"/api/file/uploadsinglefile",
"/api/file/uploadsinglefile?"
];
const isHashValid = hashCandidatePaths.some(
(candidatePath) => hashAPIPath(candidatePath) == "?hash=" + checkHash
);
if (hashAPIPath(checkquerypath) != "?hash=" + checkHash) {
if (!isHashValid) {
return respondError(res, {
status: 400,
code: "INVALID_HASH",
@@ -87,8 +89,8 @@ ApiProxy.post(async (req, res) => {
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
];
var allowedFilesFormData = {};
var invalidFiles = []; // To store the names of invalid files
const allowedFilesFormData = {};
const invalidFiles = []; // To store the names of invalid files
for (const [fileName, fileDetails] of Object.entries(uploadedFiles)) {
const file = fileDetails[0];