From 66c2194e30a2dda98216ffd6a1365e4b2bb2b73f Mon Sep 17 00:00:00 2001 From: Greg Messner Date: Mon, 12 Nov 2018 21:08:29 -0800 Subject: [PATCH] Fixed issue using Path on Windows (#270). --- src/main/java/org/gitlab4j/api/JobApi.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gitlab4j/api/JobApi.java b/src/main/java/org/gitlab4j/api/JobApi.java index 6e7737ba..5739a0e2 100644 --- a/src/main/java/org/gitlab4j/api/JobApi.java +++ b/src/main/java/org/gitlab4j/api/JobApi.java @@ -332,7 +332,9 @@ public class JobApi extends AbstractApi implements Constants { */ public File downloadSingleArtifactsFile(Object projectIdOrPath, Integer jobId, Path artifactPath, File directory) throws GitLabApiException { - Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", artifactPath); + String path = artifactPath.toString().replace("\\", "/"); + Response response = get(Response.Status.OK, getDefaultPerPageParam(), + "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path); try { if (directory == null) @@ -364,7 +366,9 @@ public class JobApi extends AbstractApi implements Constants { * @throws GitLabApiException if any exception occurs */ public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Integer jobId, Path artifactPath) throws GitLabApiException { - Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", artifactPath); + String path = artifactPath.toString().replace("\\", "/"); + Response response = get(Response.Status.OK, getDefaultPerPageParam(), + "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path); return (response.readEntity(InputStream.class)); } @@ -380,7 +384,8 @@ public class JobApi extends AbstractApi implements Constants { * @throws GitLabApiException if any exception occurs during execution */ public String getTrace(Object projectIdOrPath, int jobId) throws GitLabApiException { - Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "trace"); + Response response = get(Response.Status.OK, getDefaultPerPageParam(), + "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "trace"); return (response.readEntity(String.class)); } -- GitLab