From 5b3e87c15c9149611cd9ea75ee1d03c2a93fcb5a Mon Sep 17 00:00:00 2001 From: rmgpanw Date: Mon, 16 Mar 2026 18:58:53 +0000 Subject: [PATCH] URL-encode download URL to fix items with spaces in archive filename trud items whose archive filename contains spaces (e.g. OPCS-4, item 119: "OPCS-4.11 Data files txt.zip") fail because the unencoded URL is passed directly to httr2::request() / curl::curl_parse_url(), which rejects spaces in the host/path. Fixes #7 Co-Authored-By: Claude Sonnet 4.6 --- R/download_item.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/download_item.R b/R/download_item.R index 3de481f..cc6d640 100644 --- a/R/download_item.R +++ b/R/download_item.R @@ -151,7 +151,8 @@ download_item <- function( spinner = TRUE ) - resp_file_path <- request_download_item(url, file_path) |> + encoded_url <- utils::URLencode(url, repeated = FALSE) + resp_file_path <- request_download_item(encoded_url, file_path) |> purrr::pluck("body") |> unclass() |> normalizePath()