Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 919f64b

Browse files
authored
fix(svelte): Add trailing slash to group and directory suggestions (#63273)
This PR appends a trailing slash to org and directory suggestions so that we don't search in repos or directories that are a prefix of the current org/directory. ## Test plan Manual testing.
1 parent 8474caf commit 919f64b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/web-sveltekit/src/lib/search/codemirror/suggestions.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ export function createScopeSuggestions(options: ScopeSuggestionsOptions): Extens
8282
const options: Option[] = []
8383

8484
{
85-
const group = dirname(repoName)
85+
let group = dirname(repoName)
8686
if (group !== '.') {
87+
if (!group.endsWith('/')) {
88+
group += '/'
89+
}
8790
const option = createFilterSuggestion(
8891
FilterType.repo,
8992
`^${escapeRegExp(group)}`,
@@ -119,6 +122,9 @@ export function createScopeSuggestions(options: ScopeSuggestionsOptions): Extens
119122
const options: Option[] = []
120123

121124
if (directoryPath && directoryPath !== '.') {
125+
if (!directoryPath.endsWith('/')) {
126+
directoryPath += '/'
127+
}
122128
const option = createFilterSuggestion(
123129
FilterType.file,
124130
`^${escapeRegExp(directoryPath)}`,

0 commit comments

Comments
 (0)