Skip to content

Commit d9596f4

Browse files
committed
fix issue with downloading a single site
1 parent 631fc8e commit d9596f4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

R/flux_download.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ flux_download <- function(
5656
} else {
5757
file_list_df <- flux_listall(...)
5858
}
59-
if (length(site_ids) > 1 & !any(site_ids == "all")) {
59+
#TODO: warn if user supplies site ids AND "all"
60+
if (!any(site_ids == "all")) {
6061
file_list_df <- file_list_df %>% dplyr::filter(.data$site_id %in% site_ids)
6162
}
6263

@@ -77,9 +78,10 @@ flux_download <- function(
7778
}
7879
# check that there are rows left after filtering
7980
if (nrow(file_list_df) == 0) {
80-
cli::cli_abort(
81+
cli::cli_warn(
8182
"No files to download! Check that {.arg site_ids} are correct or that files aren't already downloaded if {.arg overwrite = FALSE}."
8283
)
84+
return(NULL)
8385
}
8486
resp <- curl::multi_download(
8587
urls = file_list_df$download_link,
@@ -94,7 +96,7 @@ flux_download <- function(
9496
dplyr::filter(.data$success == FALSE | is.na(.data$success))
9597
if (nrow(failed) > 0) {
9698
cli::cli_inform(
97-
"Retrying {nrow(failed)} failed downloads{?s}."
99+
"Retrying {nrow(failed)} failed download{?s}."
98100
)
99101
# Retry failed downloads once
100102
resp2 <- curl::multi_download(

0 commit comments

Comments
 (0)