-
Notifications
You must be signed in to change notification settings - Fork 80
Closed
Description
When using httr2::url_parse() with a url that does not have spaces encoded we get an error from curl.
It would be a nice quality of life enhancement to use URLencode() prior to parsing the url.
The below is an example of the URL that one would get from ArcGIS Online this occurs when this item has spaces in the name—these are not URL encoded (I will be making an internal bug report!)—and using httr2::url_parse() with these urls fails.
url <- "https://services1.arcgis.com/hLJbHVT9ZrDIzK0I/arcgis/rest/services/California Cities Open Platform/FeatureServer/0"
httr2::url_parse(url)
#> Error in curl::curl_parse_url(url, baseurl = base_url, decode = FALSE): Failed to parse URL: Malformed input to a URL function
httr2::url_parse(URLencode(url))
#> <httr2_url>
#> https://services1.arcgis.com/hLJbHVT9ZrDIzK0I/arcgis/rest/services/California%20Cities%20Open%20Platform/FeatureServer/0
#> • scheme: https
#> • hostname: services1.arcgis.com
#> • path:
#> /hLJbHVT9ZrDIzK0I/arcgis/rest/services/California%20Cities%20Open%20Platform/FeatureServer/0Created on 2025-07-24 with reprex v2.1.1
ref:
Line 27 in 924415c
| curl <- curl::curl_parse_url(url, baseurl = base_url) |
Metadata
Metadata
Assignees
Labels
No labels