gitlab4j-api icon indicating copy to clipboard operation
gitlab4j-api copied to clipboard

RepositoryApi should support path for getRepositoryArchive

Open odospace opened this issue 3 years ago • 0 comments

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));
}

odospace avatar Oct 20 '22 12:10 odospace