From c0dbaa2c3f56fcce51165b210d804808cdb44f3b Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 11 Sep 2025 10:49:47 +0100 Subject: [PATCH 1/4] reps files to use ticket number not title for case ref --- pages/myportal/representation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/myportal/representation.js b/pages/myportal/representation.js index 8878254d..15fbe897 100644 --- a/pages/myportal/representation.js +++ b/pages/myportal/representation.js @@ -317,7 +317,7 @@ export const getServerSideProps = wrapper.getServerSideProps( const repsFileListObj = await getRepsFilesBlobs( result.containerID, - result.caseRef, + result.ticketnumber, result.repfile_name ); From f8769d0bf15f5d0ae7cc76bfa2b899eef496d9c1 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 11 Sep 2025 10:50:45 +0100 Subject: [PATCH 2/4] url encode/decode correctly paths for hashed values --- actions/azurestorage.js | 50 +++++++++++++++++----------------- actions/index.js | 18 ++++++------ pages/api/file/deleteblob.js | 7 ++--- pages/api/file/downloadblob.js | 10 ++----- 4 files changed, 37 insertions(+), 48 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 68206580..75821451 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -210,31 +210,31 @@ export const getBlobs = async (containerName, casefolderID) => { "/api/file/downloadblob?container=" + containerName + "&casefolderID=" + - casefolderID + + encodeURIComponent(casefolderID) + "&blobname=" + - blob.name, + encodeURIComponent(blob.name), "hashedfilepath": hashAPIPath( "/api/file/downloadblob?container=" + containerName + "&casefolderID=" + - casefolderID + + encodeURIComponent(casefolderID) + "&blobname=" + - blob.name.split("/")[2] + encodeURIComponent(blob.name.split("/")[2]) ), "deletepath": "/api/file/deleteblob?container=" + containerName + "&casefolderID=" + - casefolderID + + encodeURIComponent(casefolderID) + "&blobname=" + - blob.name.split("/")[2], + encodeURIComponent(blob.name.split("/")[2]), "hasheddeletepath": hashAPIPath( "/api/file/deleteblob?container=" + containerName + "&casefolderID=" + - casefolderID + + encodeURIComponent(casefolderID) + "&blobname=" + - blob.name.split("/")[2] + encodeURIComponent(blob.name.split("/")[2]) ), "hashgetblobs": hashAPIPath( "/api/file/getbloblist?container=" + @@ -1235,17 +1235,17 @@ export const getProgressBlobs = async (containerName, caseReference) => { "/api/file/downloadblob?container=" + containerName + "&casefolderID=" + - caseReference + + encodeURIComponent(caseReference) + "&blobname=" + - blob.name.split("/")[1] + encodeURIComponent(blob.name.split("/")[1]) ), "hasheddeletepath": hashAPIPath( "/api/file/deleteblob?container=" + containerName + "&casefolderID=" + - caseReference + + encodeURIComponent(caseReference) + "&blobname=" + - blob.name.split("/")[1] + encodeURIComponent(blob.name.split("/")[1]) ), "hashgetblobs": hashAPIPath( "/api/file/getbloblist?container=" + @@ -1406,20 +1406,20 @@ export const getRepsFilesBlobs = async ( "/api/file/downloadblob?container=" + containerName + "&casefolderID=" + - blob.name.split("/")[0] + - "/" + - blob.name.split("/")[1] + + encodeURIComponent( + blob.name.split("/")[0] + "/" + blob.name.split("/")[1] + ) + "&blobname=" + - blob.name.split("/")[3], + encodeURIComponent(blob.name.split("/")[3]), "hashedfilepath": hashAPIPath( "/api/file/downloadblob?container=" + containerName + "&casefolderID=" + - blob.name.split("/")[0] + - "/" + - blob.name.split("/")[1] + + encodeURIComponent( + blob.name.split("/")[0] + "/" + blob.name.split("/")[1] + ) + "&blobname=" + - blob.name + encodeURIComponent(blob.name.split("/")[3]) ), "deletepath": "/api/file/deleteblob?container=" + @@ -1434,11 +1434,11 @@ export const getRepsFilesBlobs = async ( "/api/file/deleteblob?container=" + containerName + "&casefolderID=" + - blob.name.split("/")[0] + - "/" + - blob.name.split("/")[1] + + encodeURIComponent( + blob.name.split("/")[0] + "/" + blob.name.split("/")[1] + ) + "&blobname=" + - blob.name.split("/")[3] + encodeURIComponent(blob.name.split("/")[3]) ), "hashgetblobs": hashAPIPath( "/api/file/getbloblist?container=" + @@ -1450,7 +1450,7 @@ export const getRepsFilesBlobs = async ( ), }); } - //console.log("blobObj:", blobObj); + console.log("blobObj:", blobObj); return blobObj; }; diff --git a/actions/index.js b/actions/index.js index 8f32f50f..e995a893 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1762,9 +1762,9 @@ export const deleteBlob = async ( "/api/file/deleteblob?container=" + containerName + "&casefolderID=" + - casefolderID + + encodeURIComponent(casefolderID) + "&blobname=" + - blobName + + encodeURIComponent(blobName) + deleteblobhash ); return res.data; @@ -1785,11 +1785,9 @@ export const deleteRepBlob = async ( "/api/file/deleteblob?container=" + containerName + "&casefolderID=" + - casefolderID + - "/" + - filenamePrefix + + encodeURIComponent(casefolderID + "/" + filenamePrefix) + "&blobname=" + - blobName + + encodeURIComponent(blobName) + deleteblobhash ); return res.data; @@ -1843,14 +1841,14 @@ export const getProgressFromBlob = async (containerName, casereference) => { const res = await axios.get( BASE_URL + "/api/file/getprogressobjblob?container=" + - containerName + + encodeURIComponent(containerName) + "&casefolderID=" + - casereference + + encodeURIComponent(casereference) + hashAPIPath( "/api/file/getprogressobjblob?container=" + - containerName + + encodeURIComponent(containerName) + "&casefolderID=" + - casereference + encodeURIComponent(casereference) ) ); return res.data; diff --git a/pages/api/file/deleteblob.js b/pages/api/file/deleteblob.js index 64ca4d30..465dc167 100644 --- a/pages/api/file/deleteblob.js +++ b/pages/api/file/deleteblob.js @@ -17,12 +17,9 @@ ApiProxy.get(async (req, res) => { "/api/file/deleteblob?container=" + containerName + "&casefolderID=" + - casefolderID + + encodeURIComponent(casefolderID) + "&blobname=" + - blobName; - - //console.log(hashAPIPath(checkquerypath), checkHash); - //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + encodeURIComponent(blobName); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await deleteBlob( diff --git a/pages/api/file/downloadblob.js b/pages/api/file/downloadblob.js index 5ad78d18..9e43fdb7 100644 --- a/pages/api/file/downloadblob.js +++ b/pages/api/file/downloadblob.js @@ -20,15 +20,9 @@ ApiProxy.get(async (req, res) => { "/api/file/downloadblob?container=" + containerName + "&casefolderID=" + - casefolderID + + encodeURIComponent(casefolderID) + "&blobname=" + - blobName.trim(); - - // console.log(checkquerypath); - - // console.log(hashAPIPath(checkquerypath)); - - // console.log(req.query); + encodeURIComponent(blobName.trim()); if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { const bloblocation = From e9fc8816c1c7ac865a788a5586941b444b398854 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 11 Sep 2025 10:51:14 +0100 Subject: [PATCH 3/4] url encode values corect for hash and remove .zip files allowed --- components/case/representation/representationElements.js | 7 +------ components/elements/index.js | 9 ++------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js index 9fade1e2..5108923d 100644 --- a/components/case/representation/representationElements.js +++ b/components/case/representation/representationElements.js @@ -939,10 +939,6 @@ export const RenderFileUpload = (field) => { case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return "/assets/images/documenttypes/xlsx.png"; break; - - case "application/zip": - return "/assets/images/documenttypes/zip.png"; - break; case "image/jpeg": return "/assets/images/documenttypes/jpg.png"; case "image/png": @@ -1091,7 +1087,6 @@ export const RenderFileUpload = (field) => { [".docx"], "image/tiff": [".tif", ".tiff"], "image/jpeg": [".jpg", ".jpeg"], - "application/zip": [".zip"], "image/png": [".png"], "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"], @@ -1338,7 +1333,7 @@ export const RenderFileUpload = (field) => { ?.values?.repfile_name ) + "&blobname=" + - blob.name + + encodeURIComponent(blob.name) + blob.hashedfilepath } className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link" diff --git a/components/elements/index.js b/components/elements/index.js index 931edf43..bf38eb10 100644 --- a/components/elements/index.js +++ b/components/elements/index.js @@ -1973,10 +1973,6 @@ const RenderFileUpload = (field) => { case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return "/assets/images/documenttypes/xlsx.png"; break; - - case "application/zip": - return "/assets/images/documenttypes/zip.png"; - break; case "image/jpeg": return "/assets/images/documenttypes/jpg.png"; case "image/png": @@ -2145,7 +2141,6 @@ const RenderFileUpload = (field) => { [".docx"], "image/tiff": [".tif", ".tiff"], "image/jpeg": [".jpg", ".jpeg"], - "application/zip": [".zip"], "image/png": [".png"], "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"], @@ -2383,9 +2378,9 @@ const RenderFileUpload = (field) => { "/api/file/downloadblob?container=" + field.containerID + "&casefolderID=" + - field.ticketnumber + + encodeURIComponent(field.ticketnumber) + "&blobname=" + - blob.name + + encodeURIComponent(blob.name) + blob.hashedfilepath } className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link" From 17042d98366781cf8537a893159cb0cca40ffb20 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 11 Sep 2025 10:51:47 +0100 Subject: [PATCH 4/4] update copy to remove allowed zip files --- locales/cy/myrepresentations.json | 2 +- locales/cy/newappeal.json | 2 +- locales/en/myrepresentations.json | 2 +- locales/en/newappeal.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/locales/cy/myrepresentations.json b/locales/cy/myrepresentations.json index 63e755cc..19176379 100644 --- a/locales/cy/myrepresentations.json +++ b/locales/cy/myrepresentations.json @@ -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", "add-files-label": "Ychwanegwch eich ffeiliau", "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-invalid-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.", "fileupload-file-error-invalid-label": "yn annilys", diff --git a/locales/cy/newappeal.json b/locales/cy/newappeal.json index 3fc577ac..5d9eded1 100644 --- a/locales/cy/newappeal.json +++ b/locales/cy/newappeal.json @@ -82,7 +82,7 @@ "new-appeal-procedure-option-inperson": "Wyneb yn wyneb", "new-appeal-procedure-option-hybrid": "Hybrid", "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-invalid-type-label": "mae ganddo fath annilys. Uwchlwythwch fath a ganiateir.", "new-appeal-fileupload-file-error-invalid-label": "yn annilys", diff --git a/locales/en/myrepresentations.json b/locales/en/myrepresentations.json index e0723fe7..8c480993 100644 --- a/locales/en/myrepresentations.json +++ b/locales/en/myrepresentations.json @@ -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", "add-files-label": "Add your files", "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-invalid-type-label": "has an invalid type. Please upload an allowed type.", "fileupload-file-error-invalid-label": "is invalid", diff --git a/locales/en/newappeal.json b/locales/en/newappeal.json index 0dbdb358..3cef9e71 100644 --- a/locales/en/newappeal.json +++ b/locales/en/newappeal.json @@ -82,7 +82,7 @@ "new-appeal-procedure-option-inperson": "In person", "new-appeal-procedure-option-hybrid": "Hybrid", "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-invalid-type-label": "has an invalid type. Please upload an allowed type.", "new-appeal-fileupload-file-error-invalid-label": "is invalid",