From 103dae6d088ceb027d351d343f9da7203a9af676 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Sun, 12 Nov 2023 14:33:19 -0600 Subject: [PATCH] unit tests and fixes --- src/providers/s3/s3_provider.cpp | 9 +++++++++ tests/providers_test.cpp | 1 + 2 files changed, 10 insertions(+) diff --git a/src/providers/s3/s3_provider.cpp b/src/providers/s3/s3_provider.cpp index a9e8cd03..ee1963cb 100644 --- a/src/providers/s3/s3_provider.cpp +++ b/src/providers/s3/s3_provider.cpp @@ -362,6 +362,15 @@ auto s3_provider::get_directory_items(const std::string &api_path, directory_item_list &list) const -> api_error { try { + bool exists{}; + auto res = is_directory(api_path, exists); + if (res != api_error::success) { + return res; + } + if (not exists) { + return api_error::directory_not_found; + } + const auto cfg = get_config().get_s3_config(); const auto is_encrypted = not cfg.encryption_token.empty(); std::string key; diff --git a/tests/providers_test.cpp b/tests/providers_test.cpp index 9ad019b8..efec793c 100644 --- a/tests/providers_test.cpp +++ b/tests/providers_test.cpp @@ -294,6 +294,7 @@ static void get_api_path_from_source(const app_config &cfg, provider.get_api_path_from_source(fsi.source_path, api_path)); EXPECT_STREQ("/pt01.txt", api_path.c_str()); + EXPECT_EQ(api_error::success, provider.remove_file("/pt01.txt")); } static void