TASK22224: harden proxy file routes and expand contracts

This commit is contained in:
2026-03-23 18:14:22 +00:00
parent 91a0ab82ea
commit 3f2b945172
6 changed files with 258 additions and 70 deletions
+17 -19
View File
@@ -11,8 +11,8 @@ const hasValue = (value) =>
typeof value === "string" && value.trim().length > 0;
export default async function ApiProxy(req, res) {
var containerName = req.query.container;
var casefolderID = req.query.casefolderID;
const containerName = req.query.container;
const casefolderID = req.query.casefolderID;
if (!hasValue(containerName) || !hasValue(casefolderID)) {
return respondError(res, {
@@ -22,28 +22,26 @@ export default async function ApiProxy(req, res) {
});
}
var token = await getToken();
const token = await getToken();
var queryUrl =
const queryUrl =
"/api/file/getbloblist?container=" +
containerName +
encodeURIComponent(containerName) +
"&casefolderID=" +
casefolderID;
encodeURIComponent(casefolderID);
return axios
.get(
try {
const { data } = await axios.get(
BASE_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
return respondSuccess(res, data);
})
.catch((error) => {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "GET_BLOB_LIST_PROXY_FAILED",
message: "Failed to fetch blob list"
});
);
return respondSuccess(res, data);
} catch (error) {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "GET_BLOB_LIST_PROXY_FAILED",
message: "Failed to fetch blob list"
});
}
}