summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/blob.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-01-20 21:00:39 -0800
committerStan Hu <stanhu@gmail.com>2018-01-20 21:00:39 -0800
commitb9c537487fdd9782531c6e996d62f8e875f8dab6 (patch)
tree0508865506bbe39b3019386b7cd3b0b05e0601eb /lib/gitlab/git/blob.rb
parentba02e3a5dfb0fb95a1a32b81e893b6fe2ea39b9e (diff)
downloadgitlab-ce-b9c537487fdd9782531c6e996d62f8e875f8dab6.tar.gz
Fix Error 500 when repository has no avatarsh-fix-error-500-no-avatars
Closes #42249
Diffstat (limited to 'lib/gitlab/git/blob.rb')
-rw-r--r--lib/gitlab/git/blob.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb
index 031fccba92b..f421bf69e8f 100644
--- a/lib/gitlab/git/blob.rb
+++ b/lib/gitlab/git/blob.rb
@@ -132,6 +132,8 @@ module Gitlab
end
def find_by_gitaly(repository, sha, path, limit: MAX_DATA_DISPLAY_SIZE)
+ return unless path
+
path = path.sub(/\A\/*/, '')
path = '/' if path.empty?
name = File.basename(path)
@@ -173,6 +175,8 @@ module Gitlab
end
def find_by_rugged(repository, sha, path, limit:)
+ return unless path
+
rugged_commit = repository.lookup(sha)
root_tree = rugged_commit.tree