diff --git a/src/main/java/com/google/gerrit/plugins/checks/client/Checkers.java b/src/main/java/com/google/gerrit/plugins/checks/client/Checkers.java index bd4f930f..0dda6298 100644 --- a/src/main/java/com/google/gerrit/plugins/checks/client/Checkers.java +++ b/src/main/java/com/google/gerrit/plugins/checks/client/Checkers.java @@ -103,7 +103,9 @@ private URI buildRequestUrl() throws URISyntaxException { private URI buildRequestUrl(String suffixPath) throws URISyntaxException { return uriBuilder - .setPath(String.format("%splugins/checks/checkers/%s", getPrefix(), suffixPath)) + .setPath( + String.format( + "%splugins/checks/checkers/%s", uriBuilder.getPath() + getPrefix(), suffixPath)) .build(); } } diff --git a/src/main/java/com/google/gerrit/plugins/checks/client/Checks.java b/src/main/java/com/google/gerrit/plugins/checks/client/Checks.java index d1a04afe..edb77ea3 100644 --- a/src/main/java/com/google/gerrit/plugins/checks/client/Checks.java +++ b/src/main/java/com/google/gerrit/plugins/checks/client/Checks.java @@ -161,7 +161,7 @@ private URI buildRequestUrl(String suffixPath) throws URISyntaxException { .setPath( String.format( "%schanges/%d/revisions/%d/checks/%s", - getPrefix(), changeNumber, patchSetNumber, suffixPath)) + uriBuilder.getPath() + getPrefix(), changeNumber, patchSetNumber, suffixPath)) .build(); } } diff --git a/src/main/java/com/google/gerrit/plugins/checks/client/PendingChecks.java b/src/main/java/com/google/gerrit/plugins/checks/client/PendingChecks.java index 8ca91d9d..59c5b4ec 100644 --- a/src/main/java/com/google/gerrit/plugins/checks/client/PendingChecks.java +++ b/src/main/java/com/google/gerrit/plugins/checks/client/PendingChecks.java @@ -82,6 +82,6 @@ private URI buildRequestUrl() throws URISyntaxException { } uriBuilder.setParameter("query", queryString.toString()); } - return uriBuilder.setPath(getPrefix() + PENDING_CHECKS_PATH).build(); + return uriBuilder.setPath(uriBuilder.getPath() + getPrefix() + PENDING_CHECKS_PATH).build(); } } diff --git a/src/test/java/jenkins/plugins/gerrit/workflow/GerritCheckStepTest.java b/src/test/java/jenkins/plugins/gerrit/workflow/GerritCheckStepTest.java index 4aae7bf5..1d4637c9 100644 --- a/src/test/java/jenkins/plugins/gerrit/workflow/GerritCheckStepTest.java +++ b/src/test/java/jenkins/plugins/gerrit/workflow/GerritCheckStepTest.java @@ -81,7 +81,7 @@ public void gerritCheckStepInvokeFailSSLValidationTest() throws Exception { "" + "node {\n" + " withEnv([\n" - + " 'GERRIT_API_URL=https://%s:%s/a/project',\n" + + " 'GERRIT_API_URL=https://%s:%s',\n" + " 'GERRIT_CREDENTIALS_ID=cid',\n" + " 'BRANCH_NAME=%s',\n" + " ]) {\n" @@ -125,7 +125,7 @@ public void gerritCheckStepInvokeTest() throws Exception { "" + "node {\n" + " withEnv([\n" - + " 'GERRIT_API_URL=https://%s:%s/a/project',\n" + + " 'GERRIT_API_URL=https://%s:%s',\n" + " 'GERRIT_API_INSECURE_HTTPS=true',\n" + " 'GERRIT_CREDENTIALS_ID=cid',\n" + " 'BRANCH_NAME=%s',\n" @@ -184,7 +184,7 @@ public void gerritCheckStepTestWithUrlSet() throws Exception { "" + "node {\n" + " withEnv([\n" - + " 'GERRIT_API_URL=https://%s:%s/a/project',\n" + + " 'GERRIT_API_URL=https://%s:%s',\n" + " 'GERRIT_API_INSECURE_HTTPS=true',\n" + " 'GERRIT_CREDENTIALS_ID=cid',\n" + " 'BRANCH_NAME=%s',\n" @@ -242,7 +242,7 @@ public void gerritCheckStepTestProducesUtcTimestamps() throws Exception { "" + "node {\n" + " withEnv([\n" - + " 'GERRIT_API_URL=https://%s:%s/a/project',\n" + + " 'GERRIT_API_URL=https://%s:%s',\n" + " 'GERRIT_API_INSECURE_HTTPS=true',\n" + " 'GERRIT_CREDENTIALS_ID=cid',\n" + " 'BRANCH_NAME=%s',\n"