diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2018-06-26 15:12:08 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2018-06-26 15:12:08 +0300 |
commit | 33c950f293f13aa4c4e1b2c098695cba3cd36029 (patch) | |
tree | fd1c9d74223fa323263774938d318076e02c517b /lib/gitlab/gitaly_client | |
parent | 955f0ea57f3ab3cc06124ecea795c1375b3eb92f (diff) |
Client-side fix for Gitaly TreeEntry bug
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r-- | lib/gitlab/gitaly_client/commit_service.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb index 7f2e6441f16..077297b9d6d 100644 --- a/lib/gitlab/gitaly_client/commit_service.rb +++ b/lib/gitlab/gitaly_client/commit_service.rb @@ -76,6 +76,13 @@ module Gitlab end def tree_entry(ref, path, limit = nil) + if Pathname.new(path).cleanpath.to_s.start_with?('../') + # The TreeEntry RPC should return an empty reponse in this case but in + # Gitaly 0.107.0 and earlier we get an exception instead. This early return + # saves us a Gitaly roundtrip while also avoiding the exception. + return + end + request = Gitaly::TreeEntryRequest.new( repository: @gitaly_repo, revision: encode_binary(ref), |