Skip to content

Add support for various archive formats. #5891

Merged
merged 1 commit into from Jan 4, 2014

2 participants

@ghost
ghost commented Dec 21, 2013

Used mime-types gem instead of hardcoding content types.
Allow multiple extensions in archive route (.tar.gz, .tar.bz2).
Change content disposition from infile(?) to attachment for api.
Fixed api would return “archive” instead of {project}-{hash}.{ext}

In order for this to work, gitlabhq/gitlab_git#20 needs to be merged first.

This completes the non-gui portion of the work for http://feedback.gitlab.com/forums/176466-general/suggestions/4498612-zip-download-format-for-tags. I was going to open another pull request later for adding the button to download the zip. I wanted to add the ability to download from the "Files" tab, so you can get a bundle at a particular commit (similar to GitHub).

@ghost Unknown referenced this pull request in gitlabhq/gitlab_git Dec 21, 2013
Merged

Add support for zip archives. #20

@ghost
ghost commented Dec 21, 2013

@dosire @randx Here is the other portion of adding support for zip (with the added bonus of supporting bz2 and plain tar as well).

@jvanbaarsen
GitLab member

@jhollingsworth Can you please make sure the tests are passing?

@ghost
ghost commented Dec 21, 2013

@jvanbaarsen This PR depends on gitlabhq/gitlab_git#20 being merged. Nothing here will function until that happens. Once it is merged, these tests will pass.

@randx
GitLab member
randx commented Dec 22, 2013

@jhollingsworth we need to release new gem version of gitlab_git

@ghost
ghost commented Dec 22, 2013

@randx I have no idea what that involves, but it sounds like it will give me some time to put together some interface ideas. I tried playing with a split button with menus, but that didn't turn out so well with the current styling. Back to the drawing board.

@randx
GitLab member
randx commented Dec 23, 2013

@jhollingsworth ok. I will prepare new gem version this week

@randx
GitLab member
randx commented Dec 27, 2013

@jhollingsworth I added new gitlab_git gem version 3df417b

@randx randx commented on an outdated diff Dec 28, 2013
config/routes.rb
@@ -217,7 +217,7 @@
resource :repository, only: [:show] do
member do
get "stats"
- get "archive"
+ get "archive", constraints: { format: /(.[a-z0-9]+)+/i }
@randx
GitLab member
randx added a note Dec 28, 2013

I propose to restrict it with allowed formats: .zip, .tag.gz ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@randx randx commented on an outdated diff Dec 28, 2013
lib/api/repositories.rb
@@ -184,18 +186,20 @@ def handle_project_member_errors(errors)
# sha (optional) - the commit sha to download defaults to the tip of the default branch
# Example Request:
# GET /projects/:id/repository/archive
- get ":id/repository/archive" do
+ get ":id/repository/archive", requirements: { format: /(.[a-z0-9]+)+/i } do
@randx
GitLab member
randx added a note Dec 28, 2013

I propose to restrict it with allowed formats: .zip, .tag.gz ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jason Hollingsworth Add support for various archive formats.
Used mime-types gem instead of hardcoding content types.
Allow multiple extensions in archive route (.tar.gz, .tar.bz2).
Change content disposition from infile(?) to attachment for api.
Fixed api would return “archive” instead of {project}-{hash}.{ext}
7cc2520
@ghost
ghost commented Jan 2, 2014

@randx Updated to only include the supported formats.

@ghost
ghost commented Jan 2, 2014

@randx PR #5969 contains the UI for this feature.

@randx randx merged commit d25b5d0 into gitlabhq:master Jan 4, 2014

1 check passed

Details default The Travis CI build passed
@ghost ghost deleted the unknown repository branch Jan 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.