[bug] Directories are not importing properly for Sia #43

This commit is contained in:
Scott E. Graves 2025-04-03 19:26:42 -05:00
parent 98edf33be4
commit 533938bcef
2 changed files with 25 additions and 6 deletions

View File

@ -54,12 +54,13 @@ REPERTORY_IGNORE_WARNINGS_DISABLE()
using namespace std::chrono_literals; using namespace std::chrono_literals;
using json = nlohmann::json; using json = nlohmann::json;
inline constexpr const std::string_view REPERTORY = "repertory"; inline constexpr const std::string_view REPERTORY{"repertory"};
inline constexpr const std::wstring_view REPERTORY_W = L"repertory"; inline constexpr const std::string_view REPERTORY_DATA_NAME{"repertory2"};
inline constexpr const std::wstring_view REPERTORY_W{L"repertory"};
inline constexpr const std::uint64_t REPERTORY_CONFIG_VERSION = 2ULL; inline constexpr const std::uint64_t REPERTORY_CONFIG_VERSION{2ULL};
inline constexpr const std::string_view REPERTORY_DATA_NAME = "repertory2"; inline constexpr const std::string_view REPERTORY_MIN_REMOTE_VERSION{"2.0.0"};
inline constexpr const std::string_view REPERTORY_MIN_REMOTE_VERSION = "2.0.0"; inline constexpr const std::string_view RENTERD_MIN_VERSION{"2.0.0"};
#define REPERTORY_INVALID_HANDLE INVALID_HANDLE_VALUE #define REPERTORY_INVALID_HANDLE INVALID_HANDLE_VALUE

View File

@ -67,7 +67,7 @@ auto sia_provider::check_version(std::string &required_version,
std::string &returned_version) const -> bool { std::string &returned_version) const -> bool {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
required_version = "2.0.0"; required_version = RENTERD_MIN_VERSION;
try { try {
curl::requests::http_get get{}; curl::requests::http_get get{};
@ -240,7 +240,25 @@ auto sia_provider::get_directory_items_impl(const std::string &api_path,
directory ? 0U directory ? 0U
: entry["size"].get<std::uint64_t>(), : entry["size"].get<std::uint64_t>(),
get_last_modified(entry)); get_last_modified(entry));
if (directory) {
bool exists{};
auto res{is_directory(entry_api_path, exists)};
if (res != api_error::success) {
utils::error::raise_api_path_error(
function_name, entry_api_path, res,
"failed detect existing directory");
continue;
}
if (not exists) {
utils::error::raise_api_path_error(function_name, entry_api_path,
res, "directory not found");
continue;
}
}
get_api_item_added()(directory, file); get_api_item_added()(directory, file);
auto res{get_item_meta(entry_api_path, meta)}; auto res{get_item_meta(entry_api_path, meta)};
if (res != api_error::success) { if (res != api_error::success) {
utils::error::raise_api_path_error(function_name, entry_api_path, utils::error::raise_api_path_error(function_name, entry_api_path,