updated storage account stuff to take auth id

This commit is contained in:
2022-08-26 15:19:34 +01:00
parent 671d49c394
commit 862a953aae
18 changed files with 346 additions and 133 deletions
+11 -21
View File
@@ -1,24 +1,8 @@
import {
createContainer,
getContainers,
getBlobs,
createBlob,
uploadFile,
deleteBlob,
downloadFile,
} from "../../../actions/azurestorage";
import { BlobServiceClient, ContainerClient } from "@azure/storage-blob";
import {
DefaultAzureCredential,
InteractiveBrowserCredential,
EnvironmentCredential,
ClientSecretCredential,
} from "@azure/identity";
import { downloadFile } from "../../../actions/azurestorage";
import middleware from "../middleware/middleware";
import nextConnect from "next-connect";
import CryptoJS from "crypto-js";
import { hashAPIPath } from "../../../actions";
import middleware from "../middleware/middleware";
const WORDKEY = process.env.HASHKEY;
@@ -28,21 +12,27 @@ ApiProxy.use(middleware);
ApiProxy.get(async (req, res) => {
var containerName = req.query.container;
var casefolderID = req.query.casefolderID;
var blobName = req.query.blobname;
var checkHash = req.query.hash;
var checkquerypath =
"/api/file/downloadblob?container=" +
containerName +
"&casefolderID=" +
casefolderID +
"&blobname=" +
blobName;
blobName.trim();
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const downloaded = await downloadFile(containerName, blobName);
const downloaded = await downloadFile(
containerName,
casefolderID + "/files/" + decodeURI(blobName)
);
res.setHeader(
"content-disposition",
"attachment; filename=" + blobName
"attachment; filename=" + decodeURI(blobName)
);
return res.status(200).send(downloaded);
} else {