Skip to content

Commit af2a018

Browse files
ryancbahanclaude
andcommitted
Ensure trailing slash on directory prefixes to prevent false prefix matches
Without a trailing slash, extension_directories like "ext-a" would also match "ext-a-other/..." paths. Normalize prefixes to always end with '/' before startsWith comparison. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2d7789e commit af2a018

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/app/src/cli/models/project/config-selection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function extensionFilesForConfig(project: Project, activeConfig: TomlFile
8686
// This is a simplification — complex globs like "foo/*/bar" will over-match.
8787
// In practice, only simple directory patterns are used in app configs.
8888
const dirPrefixes = (configDirs as string[]).map((dir) => {
89-
return dir.replace(/\*.*$/, '')
89+
return dir.replace(/\*.*$/, '').replace(/\/?$/, '/')
9090
})
9191

9292
return project.extensionConfigFiles.filter((file) => {
@@ -106,7 +106,7 @@ export function webFilesForConfig(project: Project, activeConfig: TomlFile): Tom
106106
return project.webConfigFiles
107107
}
108108

109-
const dirPrefixes = (configDirs as string[]).map((dir) => dir.replace(/\*.*$/, ''))
109+
const dirPrefixes = (configDirs as string[]).map((dir) => dir.replace(/\*.*$/, '').replace(/\/?$/, '/'))
110110

111111
return project.webConfigFiles.filter((file) => {
112112
const relPath = relativePath(project.directory, file.path).replace(/\\/g, '/')

0 commit comments

Comments
 (0)