Validate refs used in controllers don't have spaces

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
This commit is contained in:
Stan Hu
2018-12-25 23:34:47 -08:00
parent d2d9fb9a86
commit e675fe4621
4 changed files with 58 additions and 0 deletions

View File

@ -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)