Merged PR 1870: Fix downloading reps links
updated download and delete links to encode with correct hash values Related work items: #18901
This commit is contained in:
+25
-25
@@ -210,31 +210,31 @@ export const getBlobs = async (containerName, casefolderID) => {
|
|||||||
"/api/file/downloadblob?container=" +
|
"/api/file/downloadblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casefolderID +
|
encodeURIComponent(casefolderID) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name,
|
encodeURIComponent(blob.name),
|
||||||
"hashedfilepath": hashAPIPath(
|
"hashedfilepath": hashAPIPath(
|
||||||
"/api/file/downloadblob?container=" +
|
"/api/file/downloadblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casefolderID +
|
encodeURIComponent(casefolderID) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name.split("/")[2]
|
encodeURIComponent(blob.name.split("/")[2])
|
||||||
),
|
),
|
||||||
"deletepath":
|
"deletepath":
|
||||||
"/api/file/deleteblob?container=" +
|
"/api/file/deleteblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casefolderID +
|
encodeURIComponent(casefolderID) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name.split("/")[2],
|
encodeURIComponent(blob.name.split("/")[2]),
|
||||||
"hasheddeletepath": hashAPIPath(
|
"hasheddeletepath": hashAPIPath(
|
||||||
"/api/file/deleteblob?container=" +
|
"/api/file/deleteblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casefolderID +
|
encodeURIComponent(casefolderID) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name.split("/")[2]
|
encodeURIComponent(blob.name.split("/")[2])
|
||||||
),
|
),
|
||||||
"hashgetblobs": hashAPIPath(
|
"hashgetblobs": hashAPIPath(
|
||||||
"/api/file/getbloblist?container=" +
|
"/api/file/getbloblist?container=" +
|
||||||
@@ -1235,17 +1235,17 @@ export const getProgressBlobs = async (containerName, caseReference) => {
|
|||||||
"/api/file/downloadblob?container=" +
|
"/api/file/downloadblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
caseReference +
|
encodeURIComponent(caseReference) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name.split("/")[1]
|
encodeURIComponent(blob.name.split("/")[1])
|
||||||
),
|
),
|
||||||
"hasheddeletepath": hashAPIPath(
|
"hasheddeletepath": hashAPIPath(
|
||||||
"/api/file/deleteblob?container=" +
|
"/api/file/deleteblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
caseReference +
|
encodeURIComponent(caseReference) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name.split("/")[1]
|
encodeURIComponent(blob.name.split("/")[1])
|
||||||
),
|
),
|
||||||
"hashgetblobs": hashAPIPath(
|
"hashgetblobs": hashAPIPath(
|
||||||
"/api/file/getbloblist?container=" +
|
"/api/file/getbloblist?container=" +
|
||||||
@@ -1406,20 +1406,20 @@ export const getRepsFilesBlobs = async (
|
|||||||
"/api/file/downloadblob?container=" +
|
"/api/file/downloadblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
blob.name.split("/")[0] +
|
encodeURIComponent(
|
||||||
"/" +
|
blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
|
||||||
blob.name.split("/")[1] +
|
) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name.split("/")[3],
|
encodeURIComponent(blob.name.split("/")[3]),
|
||||||
"hashedfilepath": hashAPIPath(
|
"hashedfilepath": hashAPIPath(
|
||||||
"/api/file/downloadblob?container=" +
|
"/api/file/downloadblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
blob.name.split("/")[0] +
|
encodeURIComponent(
|
||||||
"/" +
|
blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
|
||||||
blob.name.split("/")[1] +
|
) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name
|
encodeURIComponent(blob.name.split("/")[3])
|
||||||
),
|
),
|
||||||
"deletepath":
|
"deletepath":
|
||||||
"/api/file/deleteblob?container=" +
|
"/api/file/deleteblob?container=" +
|
||||||
@@ -1434,11 +1434,11 @@ export const getRepsFilesBlobs = async (
|
|||||||
"/api/file/deleteblob?container=" +
|
"/api/file/deleteblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
blob.name.split("/")[0] +
|
encodeURIComponent(
|
||||||
"/" +
|
blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
|
||||||
blob.name.split("/")[1] +
|
) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name.split("/")[3]
|
encodeURIComponent(blob.name.split("/")[3])
|
||||||
),
|
),
|
||||||
"hashgetblobs": hashAPIPath(
|
"hashgetblobs": hashAPIPath(
|
||||||
"/api/file/getbloblist?container=" +
|
"/api/file/getbloblist?container=" +
|
||||||
@@ -1450,7 +1450,7 @@ export const getRepsFilesBlobs = async (
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//console.log("blobObj:", blobObj);
|
console.log("blobObj:", blobObj);
|
||||||
|
|
||||||
return blobObj;
|
return blobObj;
|
||||||
};
|
};
|
||||||
|
|||||||
+8
-10
@@ -1762,9 +1762,9 @@ export const deleteBlob = async (
|
|||||||
"/api/file/deleteblob?container=" +
|
"/api/file/deleteblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casefolderID +
|
encodeURIComponent(casefolderID) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blobName +
|
encodeURIComponent(blobName) +
|
||||||
deleteblobhash
|
deleteblobhash
|
||||||
);
|
);
|
||||||
return res.data;
|
return res.data;
|
||||||
@@ -1785,11 +1785,9 @@ export const deleteRepBlob = async (
|
|||||||
"/api/file/deleteblob?container=" +
|
"/api/file/deleteblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casefolderID +
|
encodeURIComponent(casefolderID + "/" + filenamePrefix) +
|
||||||
"/" +
|
|
||||||
filenamePrefix +
|
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blobName +
|
encodeURIComponent(blobName) +
|
||||||
deleteblobhash
|
deleteblobhash
|
||||||
);
|
);
|
||||||
return res.data;
|
return res.data;
|
||||||
@@ -1843,14 +1841,14 @@ export const getProgressFromBlob = async (containerName, casereference) => {
|
|||||||
const res = await axios.get(
|
const res = await axios.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
"/api/file/getprogressobjblob?container=" +
|
"/api/file/getprogressobjblob?container=" +
|
||||||
containerName +
|
encodeURIComponent(containerName) +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casereference +
|
encodeURIComponent(casereference) +
|
||||||
hashAPIPath(
|
hashAPIPath(
|
||||||
"/api/file/getprogressobjblob?container=" +
|
"/api/file/getprogressobjblob?container=" +
|
||||||
containerName +
|
encodeURIComponent(containerName) +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casereference
|
encodeURIComponent(casereference)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return res.data;
|
return res.data;
|
||||||
|
|||||||
@@ -939,10 +939,6 @@ export const RenderFileUpload = (field) => {
|
|||||||
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
||||||
return "/assets/images/documenttypes/xlsx.png";
|
return "/assets/images/documenttypes/xlsx.png";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "application/zip":
|
|
||||||
return "/assets/images/documenttypes/zip.png";
|
|
||||||
break;
|
|
||||||
case "image/jpeg":
|
case "image/jpeg":
|
||||||
return "/assets/images/documenttypes/jpg.png";
|
return "/assets/images/documenttypes/jpg.png";
|
||||||
case "image/png":
|
case "image/png":
|
||||||
@@ -1091,7 +1087,6 @@ export const RenderFileUpload = (field) => {
|
|||||||
[".docx"],
|
[".docx"],
|
||||||
"image/tiff": [".tif", ".tiff"],
|
"image/tiff": [".tif", ".tiff"],
|
||||||
"image/jpeg": [".jpg", ".jpeg"],
|
"image/jpeg": [".jpg", ".jpeg"],
|
||||||
"application/zip": [".zip"],
|
|
||||||
"image/png": [".png"],
|
"image/png": [".png"],
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
||||||
[".xlsx"],
|
[".xlsx"],
|
||||||
@@ -1338,7 +1333,7 @@ export const RenderFileUpload = (field) => {
|
|||||||
?.values?.repfile_name
|
?.values?.repfile_name
|
||||||
) +
|
) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name +
|
encodeURIComponent(blob.name) +
|
||||||
blob.hashedfilepath
|
blob.hashedfilepath
|
||||||
}
|
}
|
||||||
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
|
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
|
||||||
|
|||||||
@@ -1973,10 +1973,6 @@ const RenderFileUpload = (field) => {
|
|||||||
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
||||||
return "/assets/images/documenttypes/xlsx.png";
|
return "/assets/images/documenttypes/xlsx.png";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "application/zip":
|
|
||||||
return "/assets/images/documenttypes/zip.png";
|
|
||||||
break;
|
|
||||||
case "image/jpeg":
|
case "image/jpeg":
|
||||||
return "/assets/images/documenttypes/jpg.png";
|
return "/assets/images/documenttypes/jpg.png";
|
||||||
case "image/png":
|
case "image/png":
|
||||||
@@ -2145,7 +2141,6 @@ const RenderFileUpload = (field) => {
|
|||||||
[".docx"],
|
[".docx"],
|
||||||
"image/tiff": [".tif", ".tiff"],
|
"image/tiff": [".tif", ".tiff"],
|
||||||
"image/jpeg": [".jpg", ".jpeg"],
|
"image/jpeg": [".jpg", ".jpeg"],
|
||||||
"application/zip": [".zip"],
|
|
||||||
"image/png": [".png"],
|
"image/png": [".png"],
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
||||||
[".xlsx"],
|
[".xlsx"],
|
||||||
@@ -2383,9 +2378,9 @@ const RenderFileUpload = (field) => {
|
|||||||
"/api/file/downloadblob?container=" +
|
"/api/file/downloadblob?container=" +
|
||||||
field.containerID +
|
field.containerID +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
field.ticketnumber +
|
encodeURIComponent(field.ticketnumber) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blob.name +
|
encodeURIComponent(blob.name) +
|
||||||
blob.hashedfilepath
|
blob.hashedfilepath
|
||||||
}
|
}
|
||||||
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
|
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"questionnaire-publish-policy-label": "Sylwch y gallai'r holl ddogfennau holiadur gael eu cyhoeddi yn unol â'n Polisi Cyhoeddi. Os bydd eich holiadur yn cynnwys unrhyw wybodaeth sensitif neu wybodaeth a allai fod yn ddifenwol, efallai y caiff ei olygu cyn ei gyhoeddi",
|
"questionnaire-publish-policy-label": "Sylwch y gallai'r holl ddogfennau holiadur gael eu cyhoeddi yn unol â'n Polisi Cyhoeddi. Os bydd eich holiadur yn cynnwys unrhyw wybodaeth sensitif neu wybodaeth a allai fod yn ddifenwol, efallai y caiff ei olygu cyn ei gyhoeddi",
|
||||||
"add-files-label": "Ychwanegwch eich ffeiliau",
|
"add-files-label": "Ychwanegwch eich ffeiliau",
|
||||||
"fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.",
|
"fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.",
|
||||||
"fileupload-file-list-label": "Dim ond ffeiliau .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg, .jpg neu .zip a dderbynnir",
|
"fileupload-file-list-label": "Dim ond ffeiliau .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg neu .jpg a dderbynnir",
|
||||||
"fileupload-file-error-filesize-label": "yn rhy fawr. Llwythwch ffeil lai i fyny.",
|
"fileupload-file-error-filesize-label": "yn rhy fawr. Llwythwch ffeil lai i fyny.",
|
||||||
"fileupload-file-error-invalid-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.",
|
"fileupload-file-error-invalid-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.",
|
||||||
"fileupload-file-error-invalid-label": "yn annilys",
|
"fileupload-file-error-invalid-label": "yn annilys",
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
"new-appeal-procedure-option-inperson": "Wyneb yn wyneb",
|
"new-appeal-procedure-option-inperson": "Wyneb yn wyneb",
|
||||||
"new-appeal-procedure-option-hybrid": "Hybrid",
|
"new-appeal-procedure-option-hybrid": "Hybrid",
|
||||||
"new-appeal-fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.",
|
"new-appeal-fileupload-drop-label": "Llusgwch a gollyngwch eich ffeiliau yma.",
|
||||||
"new-appeal-fileupload-file-list-label": "Dim ond ffeiliau .pdf, .doc, .docx, .xlsx .tif, .tiff, .jpeg, .jpg neu .zip a dderbynnir",
|
"new-appeal-fileupload-file-list-label": "Dim ond ffeiliau .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg neu .jpg a dderbynnir",
|
||||||
"new-appeal-fileupload-file-error-filesize-label": "yn rhy fawr. Llwythwch ffeil lai i fyny.",
|
"new-appeal-fileupload-file-error-filesize-label": "yn rhy fawr. Llwythwch ffeil lai i fyny.",
|
||||||
"new-appeal-fileupload-file-error-invalid-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.",
|
"new-appeal-fileupload-file-error-invalid-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.",
|
||||||
"new-appeal-fileupload-file-error-invalid-label": "yn annilys",
|
"new-appeal-fileupload-file-error-invalid-label": "yn annilys",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"questionnaire-publish-policy-label": "Please note that all questionnaire documents may be published in line with our Publishing Policy. Should your questionnaire include any sensitive information or potentially defamatory information, it may be redacted before publishing",
|
"questionnaire-publish-policy-label": "Please note that all questionnaire documents may be published in line with our Publishing Policy. Should your questionnaire include any sensitive information or potentially defamatory information, it may be redacted before publishing",
|
||||||
"add-files-label": "Add your files",
|
"add-files-label": "Add your files",
|
||||||
"fileupload-drop-label": "Drag and drop your files here.",
|
"fileupload-drop-label": "Drag and drop your files here.",
|
||||||
"fileupload-file-list-label": "Only .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg, .jpg or .zip files will be accepted",
|
"fileupload-file-list-label": "Only .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg or .jpg files will be accepted",
|
||||||
"fileupload-file-error-filesize-label": "is too large. Please upload a smaller file.",
|
"fileupload-file-error-filesize-label": "is too large. Please upload a smaller file.",
|
||||||
"fileupload-file-error-invalid-type-label": "has an invalid type. Please upload an allowed type.",
|
"fileupload-file-error-invalid-type-label": "has an invalid type. Please upload an allowed type.",
|
||||||
"fileupload-file-error-invalid-label": "is invalid",
|
"fileupload-file-error-invalid-label": "is invalid",
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
"new-appeal-procedure-option-inperson": "In person",
|
"new-appeal-procedure-option-inperson": "In person",
|
||||||
"new-appeal-procedure-option-hybrid": "Hybrid",
|
"new-appeal-procedure-option-hybrid": "Hybrid",
|
||||||
"new-appeal-fileupload-drop-label": "Drag and drop your files here.",
|
"new-appeal-fileupload-drop-label": "Drag and drop your files here.",
|
||||||
"new-appeal-fileupload-file-list-label": "Only .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg, .jpg or .zip files will be accepted",
|
"new-appeal-fileupload-file-list-label": "Only .pdf, .doc, .docx, .xlsx, .tif, .tiff, .jpeg or .jpg files will be accepted",
|
||||||
"new-appeal-fileupload-file-error-filesize-label": "is too large. Please upload a smaller file.",
|
"new-appeal-fileupload-file-error-filesize-label": "is too large. Please upload a smaller file.",
|
||||||
"new-appeal-fileupload-file-error-invalid-type-label": "has an invalid type. Please upload an allowed type.",
|
"new-appeal-fileupload-file-error-invalid-type-label": "has an invalid type. Please upload an allowed type.",
|
||||||
"new-appeal-fileupload-file-error-invalid-label": "is invalid",
|
"new-appeal-fileupload-file-error-invalid-label": "is invalid",
|
||||||
|
|||||||
@@ -17,12 +17,9 @@ ApiProxy.get(async (req, res) => {
|
|||||||
"/api/file/deleteblob?container=" +
|
"/api/file/deleteblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casefolderID +
|
encodeURIComponent(casefolderID) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blobName;
|
encodeURIComponent(blobName);
|
||||||
|
|
||||||
//console.log(hashAPIPath(checkquerypath), checkHash);
|
|
||||||
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
|
||||||
|
|
||||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||||
await deleteBlob(
|
await deleteBlob(
|
||||||
|
|||||||
@@ -20,15 +20,9 @@ ApiProxy.get(async (req, res) => {
|
|||||||
"/api/file/downloadblob?container=" +
|
"/api/file/downloadblob?container=" +
|
||||||
containerName +
|
containerName +
|
||||||
"&casefolderID=" +
|
"&casefolderID=" +
|
||||||
casefolderID +
|
encodeURIComponent(casefolderID) +
|
||||||
"&blobname=" +
|
"&blobname=" +
|
||||||
blobName.trim();
|
encodeURIComponent(blobName.trim());
|
||||||
|
|
||||||
// console.log(checkquerypath);
|
|
||||||
|
|
||||||
// console.log(hashAPIPath(checkquerypath));
|
|
||||||
|
|
||||||
// console.log(req.query);
|
|
||||||
|
|
||||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||||
const bloblocation =
|
const bloblocation =
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
const repsFileListObj = await getRepsFilesBlobs(
|
const repsFileListObj = await getRepsFilesBlobs(
|
||||||
result.containerID,
|
result.containerID,
|
||||||
result.caseRef,
|
result.ticketnumber,
|
||||||
result.repfile_name
|
result.repfile_name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user