Skip to content

Commit 5f86f18

Browse files
committed
Fix version comparison logic for checking wildcard support in "coder ssh"
This meant to check that the version was at least 2.19.0, but the logic was faulty.
1 parent 4a0f23d commit 5f86f18

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/featureSet.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,12 @@ describe("check version support", () => {
1111
expect(featureSetForVersion(semver.parse(v)).proxyLogDirectory).toBeTruthy()
1212
})
1313
})
14+
it("wildcard ssh", () => {
15+
;["v1.3.3+e491217", "v2.3.3+e491217"].forEach((v: string) => {
16+
expect(featureSetForVersion(semver.parse(v)).wildcardSSH).toBeFalsy()
17+
})
18+
;["v2.19.0", "v2.19.1", "v2.20.0+e491217", "v5.0.4+e491217"].forEach((v: string) => {
19+
expect(featureSetForVersion(semver.parse(v)).wildcardSSH).toBeTruthy()
20+
})
21+
})
1422
})

src/featureSet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export function featureSetForVersion(version: semver.SemVer | null): FeatureSet
2222
// If this check didn't exist, VS Code connections would fail on
2323
// older versions because of an unknown CLI argument.
2424
proxyLogDirectory: (version?.compare("2.3.3") || 0) > 0 || version?.prerelease[0] === "devel",
25-
wildcardSSH: (version?.compare("2.19.0") || 0) > 0 || version?.prerelease[0] === "devel",
25+
wildcardSSH: (version ? version.compare("2.19.0") : -1) >= 0 || version?.prerelease[0] === "devel",
2626
}
2727
}

0 commit comments

Comments
 (0)