diff --git a/DESCRIPTION b/DESCRIPTION index cbd6252..cb5687e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AzureStor Title: Storage Management in 'Azure' -Version: 3.5.1 +Version: 3.5.1.9000 Authors@R: c( person("Hong", "Ooi", , "hongooi73@gmail.com", role = c("aut", "cre")), person("Microsoft", role="cph") diff --git a/NEWS.md b/NEWS.md index 04c8830..b48f9b7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# AzureStor 3.5.1.9000 + +- Fix a bug when listing files in an empty ADLS filesystem (#100). + # AzureStor 3.5.1 - Fix for changed behaviour in readr 2.0.0, where `readr::read_delim` now automatically closes an input connection (#95). diff --git a/R/adls_client_funcs.R b/R/adls_client_funcs.R index 85d5fb1..d6a2722 100644 --- a/R/adls_client_funcs.R +++ b/R/adls_client_funcs.R @@ -317,6 +317,9 @@ list_adls_files <- function(filesystem, dir="/", info=c("all", "name"), httr::stop_for_status(res, storage_error_message(res)) dfchunk <- httr::content(res, simplifyVector=TRUE)$paths + if(length(dfchunk) == 0) + break + # normalise output if(is.null(dfchunk$isDirectory)) dfchunk$isDirectory <- FALSE diff --git a/tests/testthat/test04_adls.R b/tests/testthat/test04_adls.R index 0690d74..b13a78e 100644 --- a/tests/testthat/test04_adls.R +++ b/tests/testthat/test04_adls.R @@ -42,6 +42,8 @@ test_that("ADLSgen2 client interface works", expect_identical(fs, lst[["newfs1"]]) expect_true(is_empty(list_adls_files(fs, "/", info="name"))) + expect_is(list_adls_files(fs, "/"), "data.frame") + expect_true(nrow(list_adls_files(fs, "/", info="all")) == 0) orig_file <- "../resources/iris.csv" new_file <- file.path(tempdir(), "iris.csv") upload_adls_file(fs, orig_file, "iris.csv", blocksize=1000)