From cb8a407ba82626c4dc4fe6152b07161e02a3d2dc Mon Sep 17 00:00:00 2001 From: Simon Brown <1009874+simonbrowndotje@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:13:50 +0200 Subject: [PATCH] WorkspaceAPIClient: Allows "main" to be used to refer to the main/default branch. --- .../src/main/java/com/structurizr/api/WorkspaceApiClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/structurizr-client/src/main/java/com/structurizr/api/WorkspaceApiClient.java b/structurizr-client/src/main/java/com/structurizr/api/WorkspaceApiClient.java index 1ab4a715..3b7ce5c9 100644 --- a/structurizr-client/src/main/java/com/structurizr/api/WorkspaceApiClient.java +++ b/structurizr-client/src/main/java/com/structurizr/api/WorkspaceApiClient.java @@ -39,6 +39,7 @@ public class WorkspaceApiClient extends AbstractApiClient { private static final Log log = LogFactory.getLog(WorkspaceApiClient.class); + private static final String MAIN_BRANCH = "main"; private String user; @@ -234,7 +235,7 @@ public Workspace getWorkspace(long workspaceId) throws StructurizrClientExceptio log.info("Getting workspace with ID " + workspaceId); HttpGet httpGet; - if (StringUtils.isNullOrEmpty(branch)) { + if (StringUtils.isNullOrEmpty(branch) || branch.equalsIgnoreCase(MAIN_BRANCH)) { httpGet = new HttpGet(url + WORKSPACE_PATH + "/" + workspaceId); } else { httpGet = new HttpGet(url + WORKSPACE_PATH + "/" + workspaceId + "/branch/" + branch);