gitlab4j-api
gitlab4j-api copied to clipboard
RepositoryApi should support path for getRepositoryArchive
Please add support for the path parameter:
public InputStream getRepositoryArchive(Object projectIdOrPath, String sha, String path, ArchiveFormat format) throws GitLabApiException {
if (format == null) {
format = ArchiveFormat.TAR_GZ;
}
/*
* Gitlab-ce has a bug when you try to download file archives with format by using "&format=zip(or tar... etc.)",
* there is a solution to request .../archive.:format instead of .../archive?format=:format.
*
* Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/45992
* https://gitlab.com/gitlab-com/support-forum/issues/3067
*/
Form formData = new GitLabApiForm().withParam("sha", sha).withParam("path",path);
Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "archive" + "." + format.toString());
return (response.readEntity(InputStream.class));
}