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
+15 -16
View File
@@ -11,7 +11,7 @@ const hasValue = (value) =>
typeof value === "string" && value.trim().length > 0;
export default async function ApiProxy(req, res) {
var containerName = req.query.container;
const containerName = req.query.container;
if (!hasValue(containerName)) {
return respondError(res, {
@@ -21,24 +21,23 @@ export default async function ApiProxy(req, res) {
});
}
var token = await getToken();
const token = await getToken();
var queryUrl = "/api/file/getrepsblob?container=" + containerName;
const queryUrl =
"/api/file/getrepsblob?container=" + encodeURIComponent(containerName);
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_REPS_BLOB_PROXY_FAILED",
message: "Failed to fetch representation blobs"
});
);
return respondSuccess(res, data);
} catch (error) {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "GET_REPS_BLOB_PROXY_FAILED",
message: "Failed to fetch representation blobs"
});
}
}