changeset 1550:2c7d5eb588e6

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Aug 2015 15:57:44 +0200
parents e5e975e9b738
children 0dba274074eb
files Core/FileStorage/StorageAccessor.cpp OrthancServer/ServerContext.cpp
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Core/FileStorage/StorageAccessor.cpp	Mon Aug 17 10:47:04 2015 +0200
+++ b/Core/FileStorage/StorageAccessor.cpp	Mon Aug 17 15:57:44 2015 +0200
@@ -129,7 +129,7 @@
   void StorageAccessor::SetupSender(BufferHttpSender& sender,
                                     const FileInfo& info)
   {
-    Read(sender.GetBuffer(), info);
+    area_.Read(sender.GetBuffer(), info.GetUuid(), info.GetContentType());
     sender.SetContentType(GetMimeType(info.GetContentType()));
     sender.SetContentFilename(info.GetUuid() + std::string(GetFileExtension(info.GetContentType())));
   }
--- a/OrthancServer/ServerContext.cpp	Mon Aug 17 10:47:04 2015 +0200
+++ b/OrthancServer/ServerContext.cpp	Mon Aug 17 15:57:44 2015 +0200
@@ -345,9 +345,18 @@
     {
       throw OrthancException(ErrorCode_InternalError);
     }
-    
-    StorageAccessor accessor(area_);
-    accessor.Read(result, attachment);
+
+    if (uncompressIfNeeded)
+    {
+      StorageAccessor accessor(area_);
+      accessor.Read(result, attachment);
+    }
+    else
+    {
+      // Do not interpret the content of the storage area, return the
+      // raw data
+      area_.Read(result, attachment.GetUuid(), content);
+    }
   }