summaryrefslogtreecommitdiff
path: root/lib/extracts_path.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-12-25 23:34:47 -0800
committerStan Hu <stanhu@gmail.com>2019-04-14 15:26:25 -0700
commite675fe4621bc5668d5d9b72961a38be72baf23dd (patch)
treecb4c8593d12c0bfa3cc223973052d4a657fb510c /lib/extracts_path.rb
parentd2d9fb9a863909d1002029ddd19247b52264ab4d (diff)
downloadgitlab-ce-e675fe4621bc5668d5d9b72961a38be72baf23dd.tar.gz
Validate refs used in controllers don't have spacessh-validate-ref-name-in-commit
This avoids an unnecessary call to Gitaly and reduces gRPC errors. * Closes https://gitlab.com/gitlab-org/gitaly/issues/1425 * Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58572
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r--lib/extracts_path.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index b2c8d46ede1..44a9c7ea536 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -113,6 +113,9 @@ module ExtractsPath
@id = get_id
@ref, @path = extract_ref(@id)
@repo = @project.repository
+ @ref.strip!
+
+ raise InvalidPathError if @ref.match?(/\s/)
@commit = @repo.commit(@ref)