From f6833a4b89619c42f482c82d837dbc18d3be5888 Mon Sep 17 00:00:00 2001
From: Greg Messner <greg@messners.com>
Date: Tue, 9 Apr 2019 21:51:58 -0700
Subject: [PATCH] Now URL encodes the sha when fetching a single commit (#328).

---
 src/main/java/org/gitlab4j/api/CommitsApi.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/gitlab4j/api/CommitsApi.java b/src/main/java/org/gitlab4j/api/CommitsApi.java
index 6dd8ed27..5c038119 100644
--- a/src/main/java/org/gitlab4j/api/CommitsApi.java
+++ b/src/main/java/org/gitlab4j/api/CommitsApi.java
@@ -262,7 +262,7 @@ public class CommitsApi extends AbstractApi {
      * @throws GitLabApiException GitLabApiException if any exception occurs during execution
      */
     public Commit getCommit(Object projectIdOrPath, String sha) throws GitLabApiException {
-        Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha);
+        Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", urlEncode(sha));
         return (response.readEntity(Commit.class));
     }
 
@@ -314,7 +314,7 @@ public class CommitsApi extends AbstractApi {
         Form form = new GitLabApiForm()
                 .withParam("type", refType)
                 .withParam(PER_PAGE_PARAM, getDefaultPerPage());
-        Response response = get(Response.Status.OK, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "refs");
+        Response response = get(Response.Status.OK, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", urlEncode(sha), "refs");
         return (response.readEntity(new GenericType<List<CommitRef>>(){}));
     }
 
-- 
GitLab