summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ibm/management_console_rest.hpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 97ac497aec..34befd7fb1 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -243,8 +243,11 @@ inline void
for (const auto& file : std::filesystem::directory_iterator(loc))
{
const std::filesystem::path& pathObj = file.path();
- pathObjList.push_back("/ibm/v1/Host/ConfigFiles/" +
- pathObj.filename().string());
+ if (std::filesystem::is_regular_file(pathObj))
+ {
+ pathObjList.push_back("/ibm/v1/Host/ConfigFiles/" +
+ pathObj.filename().string());
+ }
}
}
asyncResp->res.jsonValue["@odata.type"] =
@@ -302,7 +305,7 @@ inline void handleFileGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
BMCWEB_LOG_DEBUG << "HandleGet on SaveArea files on path: " << fileID;
std::filesystem::path loc(
"/var/lib/bmcweb/ibm-management-console/configfiles/" + fileID);
- if (!std::filesystem::exists(loc))
+ if (!std::filesystem::exists(loc) || !std::filesystem::is_regular_file(loc))
{
BMCWEB_LOG_ERROR << loc.string() << " Not found";
asyncResp->res.result(boost::beast::http::status::not_found);