Skip to content

pin() fails when a URL contains query parameters #310

@atusy

Description

@atusy

Below is a reprex that tries to pin https://en.wikipedia.org/w/index.php?search=&title=Special%3ASearch&go=Go .
In the example, pinfails because of a malformed data.txt.
I took a look at its content, and found that data.txt is not a YAML summarizing the cache, but is a caching HTML document.

temp_dir <- tempdir()
pins::board_register_local(name = "local", cache = temp_dir)
xml2::read_html(pins::pin("https://en.wikipedia.org/w/index.php?search=&title=Special%3ASearch&go=Go"))
#> Error in yaml.load(string, error.label = error.label, ...): (/tmp/RtmpqTJQcQ/local/index_php_search_title_Special_3ASearch_go_Go/data.txt) Scanner error: mapping values are not allowed in this context at line 7, column 740
readr::read_lines(file.path(temp_dir, "local/index_php_search_title_Special_3ASearch_go_Go/data.txt"))[1:5]
#> [1] "<!DOCTYPE html>"                                     
#> [2] "<html class=\"client-nojs\" lang=\"en\" dir=\"ltr\">"
#> [3] "<head>"                                              
#> [4] "<meta charset=\"UTF-8\"/>"                           
#> [5] "<title>Search - Wikipedia</title>"

Created on 2020-11-07 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions