Skip to content

Commit 66c2194

Browse files
committed
Fixed issue using Path on Windows (#270).
1 parent 336d82b commit 66c2194

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ public InputStream downloadArtifactsFile(Object projectIdOrPath, Integer jobId,
332332
*/
333333
public File downloadSingleArtifactsFile(Object projectIdOrPath, Integer jobId, Path artifactPath, File directory) throws GitLabApiException {
334334

335-
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", artifactPath);
335+
String path = artifactPath.toString().replace("\\", "/");
336+
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
337+
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path);
336338
try {
337339

338340
if (directory == null)
@@ -364,7 +366,9 @@ public File downloadSingleArtifactsFile(Object projectIdOrPath, Integer jobId, P
364366
* @throws GitLabApiException if any exception occurs
365367
*/
366368
public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Integer jobId, Path artifactPath) throws GitLabApiException {
367-
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", artifactPath);
369+
String path = artifactPath.toString().replace("\\", "/");
370+
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
371+
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path);
368372
return (response.readEntity(InputStream.class));
369373
}
370374

@@ -380,7 +384,8 @@ public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Integer j
380384
* @throws GitLabApiException if any exception occurs during execution
381385
*/
382386
public String getTrace(Object projectIdOrPath, int jobId) throws GitLabApiException {
383-
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "trace");
387+
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
388+
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "trace");
384389
return (response.readEntity(String.class));
385390
}
386391

0 commit comments

Comments
 (0)