Skip to content

Commit 94a9a8f

Browse files
authored
Change type of artifactPath to String (#1031)
1 parent d317770 commit 94a9a8f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.io.IOException;
55
import java.io.InputStream;
66
import java.nio.file.Files;
7-
import java.nio.file.Path;
87
import java.nio.file.StandardCopyOption;
98
import java.util.List;
109
import java.util.Optional;
@@ -462,17 +461,16 @@ public InputStream downloadArtifactsFile(Object projectIdOrPath, Long jobId, Art
462461
* @return a File instance pointing to the download of the specified artifacts file
463462
* @throws GitLabApiException if any exception occurs
464463
*/
465-
public File downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, Path artifactPath, File directory) throws GitLabApiException {
464+
public File downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, String artifactPath, File directory) throws GitLabApiException {
466465

467-
String path = artifactPath.toString().replace("\\", "/");
468466
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
469-
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path);
467+
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", artifactPath);
470468
try {
471469

472470
if (directory == null)
473471
directory = new File(System.getProperty("java.io.tmpdir"));
474472

475-
String filename = artifactPath.getFileName().toString();
473+
String filename = artifactPath;
476474
File file = new File(directory, filename);
477475

478476
InputStream in = response.readEntity(InputStream.class);
@@ -497,10 +495,9 @@ public File downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, Path
497495
* @return an InputStream to read the specified artifacts file from
498496
* @throws GitLabApiException if any exception occurs
499497
*/
500-
public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, Path artifactPath) throws GitLabApiException {
501-
String path = artifactPath.toString().replace("\\", "/");
498+
public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, String artifactPath) throws GitLabApiException {
502499
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
503-
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path);
500+
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", artifactPath);
504501
return (response.readEntity(InputStream.class));
505502
}
506503

0 commit comments

Comments
 (0)