diff options
author | James Ramsay <james@jramsay.com.au> | 2018-02-19 23:41:04 +0300 |
---|---|---|
committer | James Ramsay <james@jramsay.com.au> | 2018-04-06 15:45:17 +0300 |
commit | 07f517d441ab8782286b4a59d56a630393d75e16 (patch) | |
tree | d388461feb28fbed2b5c6f52303c7eb7b0f633e3 /app/views/projects/buttons | |
parent | 0b1b9c409d3adbf4517351dbb9037ed053f73e67 (diff) |
Add new repository archive route
Repository archives are always named `<project>-<ref>-<sha>` even if
the ref is a commit. A consequence of always including the sha even
for tags is that packaging a release is more difficult because both
the ref and sha must be known by the packager.
- add `<project>/-/archive/<ref>/<filename>.<format>` route using the
`-` separator to prevent namespace collisions. If the filename is
`<project>-<ref>` or the ref is a sha, the sha will be omitted,
otherwise the default filename will be used.
- deprecate previous archive route `repository/<ref>/archive`
Diffstat (limited to 'app/views/projects/buttons')
-rw-r--r-- | app/views/projects/buttons/_download.html.haml | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/views/projects/buttons/_download.html.haml b/app/views/projects/buttons/_download.html.haml index fa9a9bfc8f7..f49f6e630d2 100644 --- a/app/views/projects/buttons/_download.html.haml +++ b/app/views/projects/buttons/_download.html.haml @@ -1,6 +1,7 @@ - pipeline = local_assigns.fetch(:pipeline) { project.latest_successful_pipeline_for(ref) } - if !project.empty_repo? && can?(current_user, :download_code, project) + - archive_prefix = "#{project.path}-#{ref.tr('/', '-')}" .project-action-button.dropdown.inline> %button.btn.has-tooltip{ title: s_('DownloadSource|Download'), 'data-toggle' => 'dropdown', 'aria-label' => s_('DownloadSource|Download') } = sprite_icon('download') @@ -10,16 +11,16 @@ %li.dropdown-header #{ _('Source code') } %li - = link_to archive_project_repository_path(project, ref: ref, format: 'zip'), rel: 'nofollow', download: '' do + = link_to project_archive_path(project, id: tree_join(ref, archive_prefix), format: 'zip'), rel: 'nofollow', download: '' do %span= _('Download zip') %li - = link_to archive_project_repository_path(project, ref: ref, format: 'tar.gz'), rel: 'nofollow', download: '' do + = link_to project_archive_path(project, id: tree_join(ref, archive_prefix), format: 'tar.gz'), rel: 'nofollow', download: '' do %span= _('Download tar.gz') %li - = link_to archive_project_repository_path(project, ref: ref, format: 'tar.bz2'), rel: 'nofollow', download: '' do + = link_to project_archive_path(project, id: tree_join(ref, archive_prefix), format: 'tar.bz2'), rel: 'nofollow', download: '' do %span= _('Download tar.bz2') %li - = link_to archive_project_repository_path(project, ref: ref, format: 'tar'), rel: 'nofollow', download: '' do + = link_to project_archive_path(project, id: tree_join(ref, archive_prefix), format: 'tar'), rel: 'nofollow', download: '' do %span= _('Download tar') - if pipeline && pipeline.latest_builds_with_artifacts.any? |