diff Core/Toolbox.cpp @ 1589:334d3a92ed83

improvements to the ServeFolders plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Aug 2015 17:43:00 +0200
parents b5bc87a7212d
children 4e56b5a206b7
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Wed Aug 26 16:49:46 2015 +0200
+++ b/Core/Toolbox.cpp	Wed Aug 26 17:43:00 2015 +0200
@@ -208,6 +208,12 @@
   void Toolbox::ReadFile(std::string& content,
                          const std::string& path) 
   {
+    if (!boost::filesystem::is_regular_file(path))
+    {
+      LOG(ERROR) << "The path does not point to a regular file: " << path;
+      throw OrthancException(ErrorCode_RegularFileExpected);
+    }
+
     boost::filesystem::ifstream f;
     f.open(path, std::ifstream::in | std::ifstream::binary);
     if (!f.good())