Skip to content

Commit f6833a4

Browse files
committed
Now URL encodes the sha when fetching a single commit (#328).
1 parent fa03dbd commit f6833a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/gitlab4j/api/CommitsApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since,
262262
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
263263
*/
264264
public Commit getCommit(Object projectIdOrPath, String sha) throws GitLabApiException {
265-
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha);
265+
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", urlEncode(sha));
266266
return (response.readEntity(Commit.class));
267267
}
268268

@@ -314,7 +314,7 @@ public List<CommitRef> getCommitRefs(Object projectIdOrPath, String sha, CommitR
314314
Form form = new GitLabApiForm()
315315
.withParam("type", refType)
316316
.withParam(PER_PAGE_PARAM, getDefaultPerPage());
317-
Response response = get(Response.Status.OK, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "refs");
317+
Response response = get(Response.Status.OK, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", urlEncode(sha), "refs");
318318
return (response.readEntity(new GenericType<List<CommitRef>>(){}));
319319
}
320320

0 commit comments

Comments
 (0)