summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2016-11-08 09:31:43 +0000
committerSean McGivern <sean@mcgivern.me.uk>2016-11-08 09:31:43 +0000
commit55e0065b49d63f53c40876196d8f110e4eb3ea32 (patch)
tree60da0989e7b06d49f5510b63ba9e6ce9b16ac501 /app/controllers
parenta6b4975724c50bc09206c0201f159c65e610859e (diff)
parent5569573a24efca76abede20370988a81d623e6a5 (diff)
downloadgitlab-ce-55e0065b49d63f53c40876196d8f110e4eb3ea32.tar.gz
Merge branch 'fix-404-on-network-when-entering-a-nonexistent-git-revision' into 'master'
Network page appear with an error message when entering nonexistent git revision Closes #2362 See merge request !7172
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/network_controller.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb
index 34318391dd9..33a152ad34f 100644
--- a/app/controllers/projects/network_controller.rb
+++ b/app/controllers/projects/network_controller.rb
@@ -5,17 +5,29 @@ class Projects::NetworkController < Projects::ApplicationController
before_action :require_non_empty_project
before_action :assign_ref_vars
before_action :authorize_download_code!
+ before_action :assign_commit
def show
@url = namespace_project_network_path(@project.namespace, @project, @ref, @options.merge(format: :json))
@commit_url = namespace_project_commit_path(@project.namespace, @project, 'ae45ca32').gsub("ae45ca32", "%s")
respond_to do |format|
- format.html
+ format.html do
+ if @options[:extended_sha1] && !@commit
+ flash.now[:alert] = "Git revision '#{@options[:extended_sha1]}' does not exist."
+ end
+ end
format.json do
@graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref])
end
end
end
+
+ def assign_commit
+ return if params[:extended_sha1].blank?
+
+ @options[:extended_sha1] = params[:extended_sha1]
+ @commit = @repo.commit(@options[:extended_sha1])
+ end
end