Skip to content

Commit 8623572

Browse files
committed
fix: transform to url only after we checked the validation result
1 parent f8414f9 commit 8623572

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
- support for checking if CLI is signed
1010
- improved progress reporting while downloading the CLI
11-
- URL validation is stricter in the connection screen
11+
- URL validation is stricter in the connection screen and URI protocol handler
1212

1313
## 2.21.1 - 2025-06-26
1414

src/main/kotlin/com/coder/gateway/util/URLExtensions.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ fun URL.withPath(path: String): URL = URL(
1515
if (path.startsWith("/")) path else "/$path",
1616
)
1717

18-
1918
fun String.validateStrictWebUrl(): WebUrlValidationResult = try {
2019
val uri = URI(this)
2120

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ class CoderWorkspacesStepView :
567567
component.apply() // Force bindings to be filled.
568568
if (settings.requireTokenAuth) {
569569
val result = fields.coderURL.validateStrictWebUrl()
570-
val newURL = fields.coderURL.toURL()
571570
if (result is WebUrlValidationResult.Invalid) {
572571
tfUrlComment.apply {
573572
this?.foreground = UIUtil.getErrorForeground()
@@ -576,6 +575,7 @@ class CoderWorkspacesStepView :
576575
}
577576
return
578577
}
578+
val newURL = fields.coderURL.toURL()
579579
val pastedToken =
580580
dialogUi.askToken(
581581
newURL,

0 commit comments

Comments
 (0)