From 25485db0a50082413e758938807c7e018ef0cb2a Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Thu, 19 Sep 2024 01:05:37 -0400 Subject: [PATCH] replace trailing dashes for org slugs --- .../java/cc/pulseapp/api/service/OrganizationService.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/cc/pulseapp/api/service/OrganizationService.java b/src/main/java/cc/pulseapp/api/service/OrganizationService.java index 1f5b313..e6ae833 100644 --- a/src/main/java/cc/pulseapp/api/service/OrganizationService.java +++ b/src/main/java/cc/pulseapp/api/service/OrganizationService.java @@ -70,9 +70,16 @@ public final class OrganizationService { throw new BadRequestException(Error.ORG_NAME_TAKEN); } // Create the org and return it + slug = slug.trim().replaceAll("-+$", ""); // Trim slug trailing dashes return orgRepository.save(new Organization(snowflakeService.generateSnowflake(), name, slug, null, owner.getSnowflake())); } + /** + * Get the organizations of the + * currently authenticated user. + * + * @return the organizations + */ @NonNull public List getOrganizations() { User user = authService.getAuthenticatedUser();