Unverified Commit 94a9a8f3 authored by Jérémie Bresson's avatar Jérémie Bresson Committed by GitHub
Browse files

Change type of artifactPath to String (#1031)

parent d317770c
...@@ -4,7 +4,6 @@ import java.io.File; ...@@ -4,7 +4,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -462,17 +461,16 @@ public class JobApi extends AbstractApi implements Constants { ...@@ -462,17 +461,16 @@ public class JobApi extends AbstractApi implements Constants {
* @return a File instance pointing to the download of the specified artifacts file * @return a File instance pointing to the download of the specified artifacts file
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
*/ */
public File downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, Path artifactPath, File directory) throws GitLabApiException { public File downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, String artifactPath, File directory) throws GitLabApiException {
String path = artifactPath.toString().replace("\\", "/");
Response response = get(Response.Status.OK, getDefaultPerPageParam(), Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path); "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", artifactPath);
try { try {
if (directory == null) if (directory == null)
directory = new File(System.getProperty("java.io.tmpdir")); directory = new File(System.getProperty("java.io.tmpdir"));
String filename = artifactPath.getFileName().toString(); String filename = artifactPath;
File file = new File(directory, filename); File file = new File(directory, filename);
InputStream in = response.readEntity(InputStream.class); InputStream in = response.readEntity(InputStream.class);
...@@ -497,10 +495,9 @@ public class JobApi extends AbstractApi implements Constants { ...@@ -497,10 +495,9 @@ public class JobApi extends AbstractApi implements Constants {
* @return an InputStream to read the specified artifacts file from * @return an InputStream to read the specified artifacts file from
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
*/ */
public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, Path artifactPath) throws GitLabApiException { public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Long jobId, String artifactPath) throws GitLabApiException {
String path = artifactPath.toString().replace("\\", "/");
Response response = get(Response.Status.OK, getDefaultPerPageParam(), Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path); "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", artifactPath);
return (response.readEntity(InputStream.class)); return (response.readEntity(InputStream.class));
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment