changeset 33:70da4ce5c7cc

merge
author Alain Mazy
date Fri, 09 Oct 2020 10:23:27 +0200
parents 8d2b29fd4de5 (diff) 662b9d3f217d (current diff)
children 7ddd840563c9 8a7a5defd5d0
files Aws/AwsS3StoragePlugin.cpp Common/StoragePlugin.cpp
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Aws/AwsS3StoragePlugin.cpp	Sat Oct 03 10:39:45 2020 +0200
+++ b/Aws/AwsS3StoragePlugin.cpp	Fri Oct 09 10:23:27 2020 +0200
@@ -130,14 +130,17 @@
       {
         return objectList[0].GetSize();
       }
-      throw StoragePluginException(std::string("error while reading file ") + path_ + ": multiple objet with same name !");
+      else if (objectList.size() > 1)
+      {
+        throw StoragePluginException(std::string("error while reading file ") + path_ + ": multiple objet with same name !");
+      }
+      throw StoragePluginException(std::string("error while reading file ") + path_ + ": object not found !");
     }
     else
     {
       throw StoragePluginException(std::string("error while reading file ") + path_ + ": " + result.GetError().GetExceptionName().c_str() + " " + result.GetError().GetMessage().c_str());
     }
   }
-
   virtual void Read(char* data, size_t size)
   {
     Aws::S3::Model::GetObjectRequest getObjectRequest;
--- a/Common/StoragePlugin.cpp	Sat Oct 03 10:39:45 2020 +0200
+++ b/Common/StoragePlugin.cpp	Fri Oct 09 10:23:27 2020 +0200
@@ -327,6 +327,13 @@
         }
 
         objectsRootPath = pluginSection.GetStringValue("RootPath", std::string());
+
+        if (objectsRootPath.size() >= 1 && objectsRootPath[0] == '/')
+        {
+          OrthancPlugins::LogError(std::string(StoragePluginFactory::GetStoragePluginName()) + ": The RootPath shall not start with a '/': " + objectsRootPath);
+          return -1;
+        }
+
         plugin->SetRootPath(objectsRootPath);
 
         if (pluginSection.IsSection(ENCRYPTION_SECTION))