From 004a4d4947d53ac49d221d302004e913e06af091 Mon Sep 17 00:00:00 2001 From: Kseniia Sumarokova <54203879+kssenii@users.noreply.github.com> Date: Thu, 11 Aug 2022 22:15:33 +0200 Subject: [PATCH] Update FileCache.cpp --- src/Common/FileCache.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Common/FileCache.cpp b/src/Common/FileCache.cpp index ca826a6e359..5a59bb6182a 100644 --- a/src/Common/FileCache.cpp +++ b/src/Common/FileCache.cpp @@ -1044,8 +1044,13 @@ void FileCache::loadCacheInfoIntoMemory(std::lock_guard & cache_lock fs::directory_iterator key_it{key_prefix_it->path()}; for (; key_it != fs::directory_iterator(); ++key_it) { - key = Key(unhexUInt(key_it->path().filename().string().data())); + if (!key_it->is_directory()) + { + LOG_WARNING(log, "Unexpected file: {}. Expected a directory", key_it->path().string()); + continue; + } + key = Key(unhexUInt(key_it->path().filename().string().data())); fs::directory_iterator offset_it{key_it->path()}; for (; offset_it != fs::directory_iterator(); ++offset_it) {