From 3cae4b0e9c1661608c5e34f04ffb0ad6e5d6ed4b Mon Sep 17 00:00:00 2001 From: Nate Danner Date: Fri, 19 Jul 2024 08:21:41 -0700 Subject: [PATCH] Revert "Revert "fix: include port if supplied (#86)" (#87)" (#88) This reverts commit 375275d38d29a27da008665f256fc8fc35f0f646. --- .../moderne/organizations/OrganizationStructureService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/moderne/organizations/OrganizationStructureService.java b/src/main/java/io/moderne/organizations/OrganizationStructureService.java index 9d26840..fd3c181 100644 --- a/src/main/java/io/moderne/organizations/OrganizationStructureService.java +++ b/src/main/java/io/moderne/organizations/OrganizationStructureService.java @@ -164,7 +164,11 @@ private static String cleanOrigin(String origin) { if (origin.startsWith("http://") || origin.startsWith("https://") || origin.startsWith("ssh://")) { try { final URL url = new URL(origin); - origin = url.getHost() + url.getPath(); + origin = url.getHost(); + if (url.getPort() != -1) { + origin += ":" + url.getPort(); + } + origin += url.getPath(); } catch (MalformedURLException e) { throw new RuntimeException(e); }