File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 11# httr2 (development version)
22
3+ * Colons in paths are no longer escaped.
4+
35# httr2 1.2.0
46
57## Lifecycle changes
Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ url_build <- function(url) {
268268 query <- I(url_query_build(url $ query ))
269269 }
270270
271- curl :: curl_modify_url(
271+ url <- curl :: curl_modify_url(
272272 scheme = url $ scheme ,
273273 host = url $ hostname ,
274274 user = url $ username ,
@@ -278,6 +278,17 @@ url_build <- function(url) {
278278 query = query ,
279279 fragment = url $ fragment
280280 )
281+
282+ # Workaround https://github.com/curl/curl/issues/17977
283+ # curl url parser esacapes colons in paths which google seems to use
284+ # quite frequently. So we hack the problem away for now, restoring the
285+ # behaviour of httr2 1.1.2
286+ if (grepl(" %3A" , url , fixed = TRUE )) {
287+ path <- curl :: curl_parse_url(url , decode = FALSE )$ path
288+ path <- gsub(" %3A" , " :" , path , fixed = TRUE )
289+ url <- curl :: curl_modify_url(url , path = I(path ))
290+ }
291+ url
281292}
282293
283294# ' Parse query parameters and/or build a string
Original file line number Diff line number Diff line change @@ -101,6 +101,13 @@ test_that("encodes params and paths", {
101101 )
102102})
103103
104+ test_that(" colons in paths are left as is" , {
105+ expect_equal(
106+ url_modify(" https://example.com" , path = " a:b/foo bar/" ),
107+ " https://example.com/a:b/foo%20bar/"
108+ )
109+ })
110+
104111test_that(" checks various query formats" , {
105112 url <- " http://example.com"
106113
You can’t perform that action at this time.
0 commit comments