repository archive API results: project id vs namespace/projectname
Created by: aadmathijssen
If I understand correctly, the API allows two ways of specifying a project: by id
and by namespace/projectname
.
When using the repository archive api url (http://doc.gitlab.com/ce/api/repositories.html#get-file-archive), these two ways of specying a project return different results (assuming project foo/bar
has id 123
):
-
GET /projects/123/repository/archive
returns atar.gz
file of the tip of the repository (which is what I would expect) -
GET /projects/foo%2Fbar/repository/archive
does not return an archive, but shows the following JSON:
{
"RepoPath":"/var/opt/gitlab/git-data/repositories/foo/bar.git",
"ArchivePrefix":"bar-master-488e92b382b54dfcbe8fbb6398520a9257cae657",
"ArchivePath":"/var/opt/gitlab/gitlab-rails/shared/cache/archive/bar.git/bar-master-488e92b382b54dfcbe8fbb6398520a9257cae657.tar.gz",
"CommitId":"488e92b382b54dfcbe8fbb6398520a9257cae657"
}
I think this is a bug, but I am not sure, since the documentation of the repository archive api only mentions that the id can be specified using "the ID of the project"; it doesn't explicitly state that the namespace/projectname
syntax is also supported. On the other hand, this syntax is supported by other api url's that I have used.
I encountered this when using composer to install dependencies from a locally installed GitLab CE 8.3.0 using the GitLab driver. This driver uses the namespace/projectname
syntax to download archives.