summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-01-22 17:46:39 +0000
committerRobert Speicher <robert@gitlab.com>2018-01-22 17:46:39 +0000
commit00aaf50326c16835983d45015e6594fbabe013ef (patch)
treefadff666115f2ec60d9d1cafcf24defab08b3dfc /lib
parentd460d0af9dcad90a7e7fdcdb4b65fdea1549c931 (diff)
parentb9c537487fdd9782531c6e996d62f8e875f8dab6 (diff)
downloadgitlab-ce-00aaf50326c16835983d45015e6594fbabe013ef.tar.gz
Merge branch 'sh-fix-error-500-no-avatars' into 'master'
Fix Error 500 when repository has no avatar Closes #42249 See merge request gitlab-org/gitlab-ce!16601
Diffstat (limited to 'lib')
-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