问题
It appears that a new bug has appeared in a package traits that I have been using and contributing to for a few years. It used to be that I use a query with a space character, and when the package returned a url, it would replace the space with %20
, and the query would work.
So, I would like users to pass the argument as Test 1
and this used to be converted behind the scenes to Test%201
which the api was happy enough to resolve. But by the time the argument gets to the httr::handle_url function, it has been changed from Test 1
to Test%201
and then the function modifyList
replaces the %20
with %2520
, thus:
Minimal Reproducible Example
old <- structure(list(scheme = "https", hostname = "example.com"), class = "url")
new <- list(query = list(queryparameter = "Test%204"))
modifyList(old, new)
Actual use case
# install.packages('traits')
library(traits)
options(betydb_url = "https://terraref.org/bety/",
betydb_api_version = 'v1')
season_4 <- betydb_query(sitename = "~Season 4",
limit = 'none')
Update I realized that the url redirects from terraref.org --> terraref.ncsa.illinois.edu, and the code works when I use the target. However, this does not seem to answer my question about why modifyList
has this behavior
Questions
- Why is the function
modifyList
replacing%20
with%2520
and - Why has this appeared in the last few months and
- How can I fix it?
来源:https://stackoverflow.com/questions/60160208/why-does-utilsmodifylist-replace-20-with-2520-in-a-url-object