Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-04-08 15:47:54 +0300
committerStan Hu <stanhu@gmail.com>2018-04-08 15:56:07 +0300
commit5c735af3b507d4d1514d1fd66318679a4a2e648e (patch)
treed8a54aa4d3fdab5878f62b3feefbe855fd991a34 /app/controllers/projects/repositories_controller.rb
parentdd552d06f6e39d5e6138a33bd7c1bffb2d3dbb1d (diff)
Handle legacy repository archive requests with no ref given
The legacy endpoint requires no reference and defaults to the root ref. Closes #45154
Diffstat (limited to 'app/controllers/projects/repositories_controller.rb')
-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