From f7d46efd29b109a1ea8e0175cf0ad08f6713f7cf Mon Sep 17 00:00:00 2001 From: Joep de Jong Date: Mon, 20 May 2024 16:59:25 +0300 Subject: [PATCH] Fix trailing slashes for mapping with additional attributes --- .../events/admin/controller/DashboardEventController.java | 2 +- .../admin/controller/DashboardSalesExportController.java | 2 +- .../ch/wisv/events/api/controller/DocumentRestController.java | 4 ++-- .../ch/wisv/events/api/controller/OrderRestController.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardEventController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardEventController.java index 9712de3e..ba320418 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardEventController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardEventController.java @@ -257,7 +257,7 @@ public String overview(Model model, RedirectAttributes redirect, @PathVariable S /** * */ - @GetMapping(value = "/overview/csv/{key}", produces = "text/csv") + @GetMapping(value = {"/overview/csv/{key}","/overview/csv/{key}/"}, produces = "text/csv") public HttpEntity csvExport(@PathVariable String key) { try { Event event = eventService.getByKey(key); diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java index c5da081b..c20b6f4a 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java @@ -69,7 +69,7 @@ public String index(Model model) { * Exports sales of month to csv * */ - @GetMapping(value="/csv", produces="text/csv") + @GetMapping(value = {"/csv", "/csv"}, produces="text/csv") public HttpEntity csvExport(@ModelAttribute SalesExportSubmission SalesExportSubmission, Model model) { model.addAttribute("SalesExportSubmission", SalesExportSubmission); diff --git a/src/main/java/ch/wisv/events/api/controller/DocumentRestController.java b/src/main/java/ch/wisv/events/api/controller/DocumentRestController.java index 6b94d8a4..77223c1f 100644 --- a/src/main/java/ch/wisv/events/api/controller/DocumentRestController.java +++ b/src/main/java/ch/wisv/events/api/controller/DocumentRestController.java @@ -36,7 +36,7 @@ public DocumentRestController(DocumentService documentService) { * @return of type byte[] */ @ResponseBody - @GetMapping(value = "/{name}", produces = MediaType.IMAGE_PNG_VALUE) + @GetMapping(value = {"/{name}","/{name}/"}, produces = MediaType.IMAGE_PNG_VALUE) public byte[] getImagePng(@PathVariable String name) { return this.getDocumentBytes(name); } @@ -49,7 +49,7 @@ public byte[] getImagePng(@PathVariable String name) { * @return of type byte[] */ @ResponseBody - @GetMapping(value = "/{name}", produces = MediaType.IMAGE_JPEG_VALUE) + @GetMapping(value = {"/{name}","/{name}/"}, produces = MediaType.IMAGE_JPEG_VALUE) public byte[] getImageJpeg(@PathVariable String name) { return this.getDocumentBytes(name); } diff --git a/src/main/java/ch/wisv/events/api/controller/OrderRestController.java b/src/main/java/ch/wisv/events/api/controller/OrderRestController.java index 7ded61a0..d03bcfac 100644 --- a/src/main/java/ch/wisv/events/api/controller/OrderRestController.java +++ b/src/main/java/ch/wisv/events/api/controller/OrderRestController.java @@ -31,7 +31,7 @@ public OrderRestController(PaymentsService paymentsService) { * * @return Status Message */ - @RequestMapping(value = "/status", method = RequestMethod.POST) + @RequestMapping(value = {"/status","/status/"}, method = RequestMethod.POST) public ResponseEntity updateOrderStatus(@RequestParam(name = "id") String providerReference) { paymentsService.updateStatusByProviderReference(providerReference); return new ResponseEntity<>(HttpStatus.OK);