Merged PR 1684: 17169 update portal with document location

Related work items: #17169
This commit is contained in:
Robert Bond
2025-06-18 08:11:53 +00:00
3 changed files with 32 additions and 24 deletions
+7 -2
View File
@@ -423,8 +423,8 @@ export const createRepPDFBlob = async (
? "846040003" ? "846040003"
: repName.indexOf("_Impact") > 0 : repName.indexOf("_Impact") > 0
? "846040029" ? "846040029"
: repName.indexOf("_Consultation_Response") > 0 : repName.indexOf("_Consultation_Response_") > 0
? "846040005" ? "846040036"
: "846040002"; : "846040002";
const tags = { const tags = {
@@ -611,6 +611,10 @@ export const uploadFile = async (formContent, containerName, foldername) => {
? "846040003" ? "846040003"
: files[prop][0].fieldName.indexOf("_Impact_") > 0 : files[prop][0].fieldName.indexOf("_Impact_") > 0
? "846040001" ? "846040001"
: files[prop][0].fieldName.indexOf(
"_Consultation_Response_"
) > 0
? "846040036"
: "846040000"; : "846040000";
const tags = { const tags = {
@@ -737,6 +741,7 @@ export const uploadSingleFile = async (
{ pattern: /_Questionnaire_/, value: "846040001" }, { pattern: /_Questionnaire_/, value: "846040001" },
{ pattern: /_Comments_/, value: "846040003" }, { pattern: /_Comments_/, value: "846040003" },
{ pattern: /_Impact_/, value: "846040001" }, { pattern: /_Impact_/, value: "846040001" },
{ pattern: /_Consultation_Response_/, value: "846040036" },
]; ];
// Find a matching pattern or fallback to default // Find a matching pattern or fallback to default
+16 -14
View File
@@ -4,23 +4,25 @@ export function middleware(request) {
const nonce = Buffer.from(crypto.randomUUID()).toString("base64"); const nonce = Buffer.from(crypto.randomUUID()).toString("base64");
const cspHeader = const cspHeader =
` `
default-src 'self'; default-src 'self';
script-src 'self' 'nonce-${nonce}' 'strict-dynamic' https: http: ${ script-src 'self' 'nonce-${nonce}' 'strict-dynamic' https: http: ${
process.env.NODE_ENV === "production" ? "" : `'unsafe-eval'` process.env.NODE_ENV === "production" ? "" : `'unsafe-eval'`
}; };
style-src 'self' 'unsafe-eval' 'unsafe-inline'; style-src 'self' 'unsafe-eval' 'unsafe-inline';
img-src 'self' 'unsafe-inline' https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com blob: data:; img-src 'self' 'unsafe-inline' https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com blob: data:;
connect-src 'self' http://127.0.0.1 https://uksouth-1.in.applicationinsights.azure.com https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com; connect-src 'self' http://127.0.0.1 https://uksouth-1.in.applicationinsights.azure.com https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com;
font-src 'self' https://pro.fontawesome.com/ https://fonts.gstatic.com/ ; font-src 'self' https://pro.fontawesome.com/ https://fonts.gstatic.com/ ;
object-src 'none'; object-src 'none';
base-uri 'self'; base-uri 'self';
frame-src https://datamap.gov.wales/; frame-src https://datamap.gov.wales/;
form-action 'self' ` + form-action 'self' ` +
process.env.NEXTAUTH_URL + process.env.NEXTAUTH_URL +
`; `;
frame-ancestors 'none'; frame-ancestors 'none';
upgrade-insecure-requests; upgrade-insecure-requests;
`; `;
//const cspHeader = "";
// csp += `base-uri 'self';`; // csp += `base-uri 'self';`;
// csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://ukwest-0.in.applicationinsights.azure.com https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.com/;`; // csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://ukwest-0.in.applicationinsights.azure.com https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.com/;`;
+9 -8
View File
@@ -227,14 +227,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
preferredLocale = cookies.pedw_locale; preferredLocale = cookies.pedw_locale;
} }
if (preferredLocale !== locale) { // if (preferredLocale !== locale) {
return { // return {
redirect: { // redirect: {
destination: `/${preferredLocale}`, // destination: `/${preferredLocale}/myportal`,
permanent: false, // permanent: false,
}, // locale: preferredLocale,
}; // },
} // };
// }
const showLoginCheck = Boolean(process.env.SHOWLOGIN); const showLoginCheck = Boolean(process.env.SHOWLOGIN);
const showReps = Boolean(process.env.SHOWREPRESENTATIONS); const showReps = Boolean(process.env.SHOWREPRESENTATIONS);