Check for wildcard/conditional host patterns in ~/.ssh/config before normalizing for connections dropdown (#1743)

This commit is contained in:
Evan Simkowitz 2025-01-15 20:34:42 -08:00 committed by GitHub
parent e555eaa765
commit 68a88857cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -877,8 +877,11 @@ func resolveSshConfigPatterns(configFiles []string) ([]string, error) {
// for each host, find the first good alias
for _, hostPattern := range host.Patterns {
hostPatternStr := hostPattern.String()
if hostPatternStr == "" || strings.Contains(hostPatternStr, "*") || strings.Contains(hostPatternStr, "?") || strings.Contains(hostPatternStr, "!") {
continue
}
normalized := remote.NormalizeConfigPattern(hostPatternStr)
if !strings.Contains(hostPatternStr, "*") && !strings.Contains(hostPatternStr, "?") && !strings.Contains(hostPatternStr, "!") && !alreadyUsed[normalized] {
if !alreadyUsed[normalized] {
discoveredPatterns = append(discoveredPatterns, normalized)
alreadyUsed[normalized] = true
break