Skip to content

How to harden the formatting of URLs? (issue with # encoding) #357

@mjsteinbaugh

Description

@mjsteinbaugh

I came across an edge case where some URLs are not rendering as expected.

Here's a minimal reprex:

## From googlesheets4 vignette:
## https://googlesheets4.tidyverse.org/articles/googlesheets4.html

url <- "https://docs.google.com/spreadsheets/d/1U6Cf_qEOhiR9AZqTqS3mbMF3zt2db48ZP5v3rkrAEJY/edit#gid=780868077"

cli::cli_alert(sprintf("Downloading '%s'.", url))
## → Downloading 'https://docs.google.com/spreadsheets/d/1U6Cf_qEOhiR9AZqTqS3mbMF3zt2db48ZP5v3rkrAEJY/edit#gid=780868077'.

cli::cli_alert(sprintf("Downloading {.file %s}.", url))
## → Downloading

cli::cli_alert(sprintf("Downloading {.url %s}.", url))
## → Downloading

cli::cli_alert(sprintf("Downloading {.val %s}.", url))
## → Downloading

cli::cli_alert(sprintf("Downloading {.var %s}.", url))
## → Downloading

Is there a way to harden the encoding of URLs to work better with the cli package?

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