From c2bcc62eed9c2c73fb66e854409477ec9faf2512 Mon Sep 17 00:00:00 2001 From: jgunnCO <135321532+jgunnCO@users.noreply.github.com> Date: Tue, 7 May 2024 11:09:48 +0100 Subject: [PATCH 1/3] amend schemeeditorcontroller (#302) --- .../gap/adminbackend/controllers/SchemeEditorController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/SchemeEditorController.java b/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/SchemeEditorController.java index 8ce2d2b9..0b7a8fec 100644 --- a/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/SchemeEditorController.java +++ b/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/SchemeEditorController.java @@ -55,7 +55,7 @@ public ResponseEntity> getSchemeEditors(@PathVariable fin @PostMapping public ResponseEntity addEditorToScheme(@PathVariable final Integer schemeId, @RequestBody @Valid final SchemeEditorPostDTO newEditorDto, final HttpServletRequest request) { final String jwt = HelperUtils.getJwtFromCookies(request, userServiceConfig.getCookieName()); - schemeEditorService.addEditorToScheme(schemeId, newEditorDto.getEditorEmailAddress(), jwt); + schemeEditorService.addEditorToScheme(schemeId, newEditorDto.getEditorEmailAddress().toLowerCase(), jwt); return ResponseEntity.ok("Editor added to scheme successfully"); } From 77bb90a4c24ae3bc14e60255c4bf93346b5214a4 Mon Sep 17 00:00:00 2001 From: arul-fourseals Date: Thu, 8 Aug 2024 11:56:30 +0100 Subject: [PATCH 2/3] url validation updated to accept # symbol --- .../validation/validators/AdvertPageResponseValidator.java | 2 +- .../validation/validators/AdvertPageResponseValidatorTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/gov/cabinetoffice/gap/adminbackend/validation/validators/AdvertPageResponseValidator.java b/src/main/java/gov/cabinetoffice/gap/adminbackend/validation/validators/AdvertPageResponseValidator.java index 642588e6..e6da6264 100644 --- a/src/main/java/gov/cabinetoffice/gap/adminbackend/validation/validators/AdvertPageResponseValidator.java +++ b/src/main/java/gov/cabinetoffice/gap/adminbackend/validation/validators/AdvertPageResponseValidator.java @@ -216,7 +216,7 @@ private SimpleEntry validateURL(GrantAdvertQuestionResponse ques // (incl. .com) (repeating) | // (optional) slash | (optional) additional path | (optional) slash | // (optional) query params - String urlValidPattern = "^(http://|https://)(www.)?((?!www)[a-zA-Z0-9\\-]{2,}+)(\\.[a-zA-Z0-9\\-]{2,})+(/)?(/[a-z0-9\\-._~%!$&'()*+,;=:@]+)*?(/)?(\\?[a-z0-9\\-._~%!$&'()*+,;=:@/]*)?$"; + String urlValidPattern = "^(http://|https://)(www.)?((?!www)[a-zA-Z0-9\\-]{2,}+)(\\.[a-zA-Z0-9\\-]{2,})+(/)?(/[a-z0-9\\-._~%!$&'()*+,;=:@#]+)*?(/)?(\\?[a-z0-9\\-._~%!$&'()*+,;=:@#/]*)?$"; Pattern pattern = Pattern.compile(urlValidPattern, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(question.getResponse()); diff --git a/src/test/java/gov/cabinetoffice/gap/adminbackend/validation/validators/AdvertPageResponseValidatorTest.java b/src/test/java/gov/cabinetoffice/gap/adminbackend/validation/validators/AdvertPageResponseValidatorTest.java index 3d5e622b..a525ddb4 100644 --- a/src/test/java/gov/cabinetoffice/gap/adminbackend/validation/validators/AdvertPageResponseValidatorTest.java +++ b/src/test/java/gov/cabinetoffice/gap/adminbackend/validation/validators/AdvertPageResponseValidatorTest.java @@ -928,7 +928,8 @@ private static Stream validUrls() { Arguments.of("https://www.google.co.uk/long/path?query=var&query2=var"), Arguments.of("http://www.google.co.uk/long/path?query=var&query2=var"), Arguments.of("https://google.co.uk/long/path?query=var&query2=var"), - Arguments.of("http://google.co.uk/long/path?query=var&query2=var")); + Arguments.of("http://google.co.uk/long/path?query=var&query2=var"), + Arguments.of("https://google.co.uk/competition/1989/overview/63441f1e-850b-4581-986d-cd2f6c6c226d#summary")); } // @formatter:on From 495d96665f58c71cad5d2698af27500f231a2541 Mon Sep 17 00:00:00 2001 From: Arulelango Jayaraman Date: Mon, 12 Aug 2024 10:29:26 +0100 Subject: [PATCH 3/3] existing unknown chane removed (#307) --- .../gap/adminbackend/controllers/SchemeEditorController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/SchemeEditorController.java b/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/SchemeEditorController.java index 0b7a8fec..8ce2d2b9 100644 --- a/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/SchemeEditorController.java +++ b/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/SchemeEditorController.java @@ -55,7 +55,7 @@ public ResponseEntity> getSchemeEditors(@PathVariable fin @PostMapping public ResponseEntity addEditorToScheme(@PathVariable final Integer schemeId, @RequestBody @Valid final SchemeEditorPostDTO newEditorDto, final HttpServletRequest request) { final String jwt = HelperUtils.getJwtFromCookies(request, userServiceConfig.getCookieName()); - schemeEditorService.addEditorToScheme(schemeId, newEditorDto.getEditorEmailAddress().toLowerCase(), jwt); + schemeEditorService.addEditorToScheme(schemeId, newEditorDto.getEditorEmailAddress(), jwt); return ResponseEntity.ok("Editor added to scheme successfully"); }