Skip to content

Commit

Permalink
WorkspaceAPIClient: Allows "main" to be used to refer to the main/def…
Browse files Browse the repository at this point in the history
…ault branch.
  • Loading branch information
simonbrowndotje committed Oct 17, 2024
1 parent 1e6c2a3 commit cb8a407
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cb8a407

Please sign in to comment.