From 2fc799641357034808b77b595606745014deb662 Mon Sep 17 00:00:00 2001 From: Eliot McIntire Date: Tue, 6 Aug 2024 16:42:49 -0700 Subject: [PATCH] revert rm download.file --- R/Require-helpers.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/R/Require-helpers.R b/R/Require-helpers.R index c3e4fe72..1954e974 100644 --- a/R/Require-helpers.R +++ b/R/Require-helpers.R @@ -1405,15 +1405,15 @@ masterMainHEAD <- function(url, need) { for (tryNum in 1:2) { if (!isTRUE(getOption("Require.offlineMode"))) { - # if (is.null(token)) { - # tryCatch(download.file(URL, destfile = df, quiet = TRUE),# need TRUE to hide ghp - # error = function(e) { - # if (is.null(token)) - # e$message <- stripGHP(ghp, e$message) - # if (tryNum > 1) - # messageVerbose(e$message, verbose = verbose) - # }) - # } else { + if (is.null(token)) { + tryCatch(download.file(URL, destfile = df, quiet = TRUE),# need TRUE to hide ghp + error = function(e) { + if (is.null(token)) + e$message <- stripGHP(ghp, e$message) + if (tryNum > 1) + messageVerbose(e$message, verbose = verbose) + }) + } else { a <- try(GETWauthThenNonAuth(url, token, verbose = verbose)) if (is(a, "try-error")) { if (any(grepl("Could not resolve host", a))) { @@ -1426,7 +1426,7 @@ masterMainHEAD <- function(url, need) { # a <- httr::GET(url, httr::add_headers()) data <- httr::content(a, "raw") writeBin(data, df) - # } + } if (file.exists(df)) break if (is.null(token))