Our search language takes regular expressions as input so we need to escape the user input. Additionally for repository we need to add anchors otherwise we will match all repos that contain another repo name. For example at Sourcegraph we have the deploy-sourcegraph repo as well as many example of deploy-sourcegraph-${target} repos.
Test Plan: remote file search on deploy-sourcegraph only returned filenames for deploy-sourcegraph when signed into s2. Additionally adding "." in the filename selection only selected "." and didn't match any char.
Our search language takes regular expressions as input so we need to escape the user input. Additionally for repository we need to add anchors otherwise we will match all repos that contain another repo name. For example at Sourcegraph we have the deploy-sourcegraph repo as well as many example of deploy-sourcegraph-${target} repos.
Test Plan: remote file search on deploy-sourcegraph only returned filenames for deploy-sourcegraph when signed into s2. Additionally adding "." in the filename selection only selected "." and didn't match any char.
See before and after screenshots
Before
After
Fixes https://linear.app/sourcegraph/issue/CODY-2265/regex-escape-reponame-and-filepath-for-remote-files-provider