Skip to content

Commit

Permalink
remove trailing slashes from databricks(workspace) (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch authored Aug 29, 2024
1 parent 9949473 commit 0f05792
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# odbc (development version)

* Trailing slashes are now automatically removed from `databricks(workspace)`,
guarding users from an uninformative driver message (@simonpcouch, #827).

* `snowflake()` now allows passing `uid` without `pwd` when
`authenticator = "externalbrowser"` (@simonpcouch, #817).

Expand Down
2 changes: 1 addition & 1 deletion R/driver-databricks.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ databricks_host <- function(workspace) {
call = quote(DBI::dbConnect())
)
}
gsub("https://", "", workspace)
gsub("https://|/$", "", workspace)
}

#' @importFrom utils packageVersion
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-driver-databricks.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ test_that("errors if can't find driver", {

test_that("databricks host validates inputs", {
expect_equal(databricks_host("https://my-host.com"), "my-host.com")
expect_equal(databricks_host("https://my-host.com/"), "my-host.com")
expect_equal(databricks_host("my-host.com/"), "my-host.com")
expect_snapshot(databricks_host(""), error = TRUE)
})

Expand Down

0 comments on commit 0f05792

Please sign in to comment.