diff --git a/src/main/java/org/kohsuke/github/GHPullRequest.java b/src/main/java/org/kohsuke/github/GHPullRequest.java index 894c146497..0de09b8b32 100644 --- a/src/main/java/org/kohsuke/github/GHPullRequest.java +++ b/src/main/java/org/kohsuke/github/GHPullRequest.java @@ -410,10 +410,10 @@ public void refresh() throws IOException { return; // cannot populate, will have to live with what we have } - URL url = getUrl(); - if (url != null) { - root().createRequest().withPreview(SHADOW_CAT).setRawUrlPath(url.toString()).fetchInto(this).wrapUp(owner); - } + root().createRequest() + .withPreview(SHADOW_CAT) + .withUrlPath("/repos/" + owner.getOwnerName() + "/" + getRepository().getName() + "/pulls/" + number) + .fetchInto(this); } /** diff --git a/src/main/java/org/kohsuke/github/GitHubPageIterator.java b/src/main/java/org/kohsuke/github/GitHubPageIterator.java index 36da9cd24b..34b15d318f 100644 --- a/src/main/java/org/kohsuke/github/GitHubPageIterator.java +++ b/src/main/java/org/kohsuke/github/GitHubPageIterator.java @@ -171,7 +171,13 @@ private GitHubRequest findNextURL(GitHubRequest nextRequest, GitHubResponse n // found the next page. This should look something like // ; rel="next" int idx = token.indexOf('>'); - result = nextRequest.toBuilder().setRawUrlPath(token.substring(1, idx)).build(); + String nextUrl = token.substring(1, idx); + + // Adjust the base URL to match the client’s configuration + nextUrl = nextUrl.replace(GitHubClient.GITHUB_URL, client.getApiUrl()); // client.getApiUrl() == + // root() + + result = nextRequest.toBuilder().setRawUrlPath(nextUrl).build(); break; } }