Skip to content

Commit

Permalink
Fix organization domain extracting from base_url
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-bodnar committed Nov 1, 2022
1 parent 80598c8 commit 9ed80bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public static String getOrganization(String baseUrl) {
String organization = baseUrl
.replaceAll("^https?:?/?/?", "")
.replaceAll("(\\.?[^.]+)?\\.?crowdin.dev(/api/v2)?/?$", "")
.replaceAll("\\.?api\\.", "")
.replaceAll("\\.?crowdin.com(/api/v2)?/?$", "")
.replaceAll("\\.?api", "")
.replaceAll(".+\\.test$", "")
.replaceAll("\\.e-test$", "");
return (StringUtils.isEmpty(organization)) ? null : organization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ private static Stream<Arguments> testGetOrganization() {
arguments("https://Daanya.api.crowdin.com", "Daanya"),
arguments("https://crowdin.com", null),
arguments("https://api.crowdin.com", null),
arguments("https://apicustom.crowdin.com", "apicustom"),
arguments("https://apicustom.api.crowdin.com", "apicustom"),
arguments("andriy.crowdin.com", "andriy")
);
}
Expand Down

0 comments on commit 9ed80bb

Please sign in to comment.