Bug fix: SearchFilesByName errors when starting with a dash for basic search

Context

We are seeing errors for the repository search when the name searched for starts with a dash.

Screenshot_2022-11-14_at_10.34.30

Related to #386435 (closed) but for basic search, not advanced search.

  • Location: SearchFilesByName in Gitlab::GitalyClient::RepositoryService
  • Level: project
  • Scope: blobs
  • Type: basic
  • Web & API
  • Error: cannot start with dash '-'

Impact

227 errors in 7 days.

Possible fix

Add dash (-) to symbols that get substituted before making the query: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/git/repository.rb#L1064

Edited by Madelein van Niekerk