diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-08 09:31:43 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-08 09:31:43 +0000 |
commit | 55e0065b49d63f53c40876196d8f110e4eb3ea32 (patch) | |
tree | 60da0989e7b06d49f5510b63ba9e6ce9b16ac501 /lib | |
parent | a6b4975724c50bc09206c0201f159c65e610859e (diff) | |
parent | 5569573a24efca76abede20370988a81d623e6a5 (diff) | |
download | gitlab-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 'lib')
-rw-r--r-- | lib/extracts_path.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index 9b74364849e..82551f1f222 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -106,7 +106,7 @@ module ExtractsPath # resolved (e.g., when a user inserts an invalid path or ref). def assign_ref_vars # assign allowed options - allowed_options = ["filter_ref", "extended_sha1"] + allowed_options = ["filter_ref"] @options = params.select {|key, value| allowed_options.include?(key) && !value.blank? } @options = HashWithIndifferentAccess.new(@options) @@ -114,17 +114,13 @@ module ExtractsPath @ref, @path = extract_ref(@id) @repo = @project.repository - if @options[:extended_sha1].present? - @commit = @repo.commit(@options[:extended_sha1]) - else - @commit = @repo.commit(@ref) + @commit = @repo.commit(@ref) - if @path.empty? && !@commit && @id.ends_with?('.atom') - @id = @ref = extract_ref_without_atom(@id) - @commit = @repo.commit(@ref) + if @path.empty? && !@commit && @id.ends_with?('.atom') + @id = @ref = extract_ref_without_atom(@id) + @commit = @repo.commit(@ref) - request.format = :atom if @commit - end + request.format = :atom if @commit end raise InvalidPathError unless @commit |