diff --git a/backend/package-lock.json b/backend/package-lock.json index 0b2b2de9d..2e285bb7c 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -33,6 +33,7 @@ "date-fns": "^3.6.0", "date-fns-tz": "^3.1.3", "dotenv": "^16.0.1", + "escape-html": "^1.0.3", "form-data": "^4.0.0", "geojson": "^0.5.0", "jest-mock": "^29.6.1", diff --git a/backend/package.json b/backend/package.json index b934ef0f9..5fa883561 100644 --- a/backend/package.json +++ b/backend/package.json @@ -64,6 +64,7 @@ "date-fns": "^3.6.0", "date-fns-tz": "^3.1.3", "dotenv": "^16.0.1", + "escape-html": "^1.0.3", "form-data": "^4.0.0", "geojson": "^0.5.0", "jest-mock": "^29.6.1", diff --git a/backend/src/v1/document/document.controller.ts b/backend/src/v1/document/document.controller.ts index f87c51b95..9f26a7f50 100644 --- a/backend/src/v1/document/document.controller.ts +++ b/backend/src/v1/document/document.controller.ts @@ -8,6 +8,7 @@ import { Roles } from "../../auth/decorators/roles.decorator"; import { Token } from "../../auth/decorators/token.decorator"; import { COMPLAINT_TYPE } from "../../types/models/complaints/complaint-type"; import { format } from "date-fns"; +import { escape } from "escape-html"; @UseGuards(JwtRoleGuard) @ApiTags("document") @@ -27,8 +28,6 @@ export class DocumentController { @Res() res: Response, ): Promise { try { - this.logger.debug("TIMEZONE: ", tz); - const fileName = `Complaint-${id}-${type}-${format(new Date(), "yyyy-MM-dd")}.pdf`; const response = await this.service.exportComplaint(id, type, fileName, tz); @@ -47,7 +46,7 @@ export class DocumentController { res.end(buffer); } catch (error) { this.logger.error(`exception: unable to export document for complaint: ${id} - error: ${error}`); - res.status(500).send(`exception: unable to export document for complaint: ${id} - error: ${error}`); + res.status(500).send(`exception: unable to export document for complaint: ${escape(id)}`); } } } diff --git a/frontend/src/app/components/mapping/leaflet-map-with-multiple-points.tsx b/frontend/src/app/components/mapping/leaflet-map-with-multiple-points.tsx index 36bc3ebe7..efa06172d 100644 --- a/frontend/src/app/components/mapping/leaflet-map-with-multiple-points.tsx +++ b/frontend/src/app/components/mapping/leaflet-map-with-multiple-points.tsx @@ -82,7 +82,7 @@ const LeafletMapWithMultiplePoints: React.FC = ({ complaintType, marke const bannerType = unmappedComplaints >= 1 ? "unmapped" : "no-results"; const info = unmappedComplaints >= 1 - ? `The exact location of ${unmappedComplaints} complaint${isPluralized} could not be determined.` + ? `${unmappedComplaints} complaint${isPluralized} could not be mapped` : "No complaints found."; return (