summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-04-09 07:49:51 +0000
committerRobert Speicher <rspeicher@gmail.com>2018-04-10 19:01:52 -0500
commit9719d276a0662f59ef5b7313cecff94bd37301c7 (patch)
tree060b34a4f16102a02875af78f7c75904ce7ed6d2 /app
parent88b903c569c8c47433d291c215c43396c297ace8 (diff)
downloadgitlab-ce-9719d276a0662f59ef5b7313cecff94bd37301c7.tar.gz
Merge branch 'sh-handle-legacy-archive-requests' into 'master'
Handle legacy repository archive requests with no ref given Closes #45154 See merge request gitlab-org/gitlab-ce!18246
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/repositories_controller.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb
index a6167e9dc6c..937b0e39cbd 100644
--- a/app/controllers/projects/repositories_controller.rb
+++ b/app/controllers/projects/repositories_controller.rb
@@ -16,8 +16,10 @@ class Projects::RepositoriesController < Projects::ApplicationController
def archive
append_sha = params[:append_sha]
- shortname = "#{@project.path}-#{@ref.tr('/', '-')}"
- append_sha = false if @filename == shortname
+ if @ref
+ shortname = "#{@project.path}-#{@ref.tr('/', '-')}"
+ append_sha = false if @filename == shortname
+ end
send_git_archive @repository, ref: @ref, format: params[:format], append_sha: append_sha
rescue => ex
@@ -27,6 +29,9 @@ class Projects::RepositoriesController < Projects::ApplicationController
def assign_archive_vars
@id = params[:id]
+
+ return unless @id
+
@ref, @filename = extract_ref(@id)
rescue InvalidPathError
render_404