From 39917f1094c7798ce13f42bf841cb61102429ecc Mon Sep 17 00:00:00 2001 From: Lisec Date: Mon, 20 Nov 2023 09:07:48 +0100 Subject: [PATCH] Zenodo API change needed fix. --- DESCRIPTION | 4 ++-- R/fnc_read_zenodo.R | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 80b4c36..5f1daca 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: eCerto Title: Statistical Tests for the Production of Reference Materials -Version: 0.2.9 -Date: 2023-10-24 +Version: 0.2.11 +Date: 2023-11-20 Authors@R: c( person("Jan", "Lisec", , "jan.lisec@bam.de", role = c("cre", "aut"), comment = c(ORCID = "0000-0003-1220-2286")), diff --git a/R/fnc_read_zenodo.R b/R/fnc_read_zenodo.R index 3571ce9..e4ad0f5 100644 --- a/R/fnc_read_zenodo.R +++ b/R/fnc_read_zenodo.R @@ -27,18 +27,18 @@ read_zenodo <- function(id) { content <- jsonlite::fromJSON(rawToChar(zen_record$content)) # get and check url - #file_urls <- content$files$links$self - file_urls <- content$files$filename + file_urls <- content$files$links$self + #file_urls <- content$files$filename if (length(file_urls)>=2) { message("[read_zenodo] More than one file in this zenodo record, please select a unique id. Reading first file only.") file_urls <- file_urls[1] } # download from url to temp file and load in R session - dest <- fs::path(tempdir(), basename(file_urls)) + dest <- fs::path(tempdir(), basename(gsub("/content$", "", file_urls))) # paste url together - file_urls <- paste0(base_url, id, "/files/", file_urls, "/content") + #file_urls <- paste0(base_url, id, "/files/", file_urls, "/content") #browser() #paste0("https://zenodo.org/api/records/8380870/files/", content$files$filename) out <- try(curl::curl_download(url = file_urls, destfile = dest, quiet = FALSE), silent = TRUE)