Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix urls #366

Closed
wants to merge 6 commits into from
Closed

Fix urls #366

wants to merge 6 commits into from

Conversation

colearendt
Copy link
Member

  • add some otherwise failing tests on protocol mismatches
  • address one case where "magic" ports (443 and 80, which tend to vanish) can cause issues in url parsing

rsconnect_remote_path_from_url <- function(board, url) {
url <- gsub("^https?://", "", url)
server <- gsub("^https?://", "", board$server)
url <- gsub("^https?://", "", strip_default_ports(url))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use urtools to do everything here? I think that might be easier to understand and less error prone.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and maybe use httr::parse_url() to avoid adding another dependency?



path <- rsconnect_remote_path_from_url(list(server = "https://foo.com:8443/rsc"), "http://foo.com:8443/rsc/foo/bar")
expect_equal(path, "/foo/bar")
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggesting a new test case based on #379 that seems to be fixed by some changes in this PR. (because of trailing / added after server now)

it is not about protocol and port, so maybe in a new test_that call ?

path <- rsconnect_remote_path_from_url(list(server = "https://foo.com"), "http://foo.com/bar/foo-com_baz")
expect_equal(path, "/bar/foo-com_baz")

With current version (not this PR)

pins:::rsconnect_remote_path_from_url(list(server = "https://foo.com"), "http://foo.com/bar/foo-com_baz")
[1] "_baz"

@hadley
Copy link
Member

hadley commented Apr 15, 2021

Closing because I've completely rewritten all this code in #426, and I'm pretty sure this is no longer needed.

@hadley hadley closed this Apr 15, 2021
@github-actions
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants