changeset 5059:5c997c72603c

Fix the Storage Cache for compressed files (bug introduced in 1.11.0)
author Alain Mazy <am@osimis.io>
date Mon, 08 Aug 2022 09:59:07 +0200
parents d4e5ca0c9307
children e69a3ff39bc5
files NEWS OrthancFramework/Sources/FileStorage/StorageAccessor.cpp
diffstat 2 files changed, 5 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Aug 03 10:49:50 2022 +0200
+++ b/NEWS	Mon Aug 08 09:59:07 2022 +0200
@@ -11,6 +11,7 @@
 
 * Fix the "Never" option of the "StorageAccessOnFind" that was sill accessing
   files (bug introduced in 1.11.0).
+* Fix the Storage Cache for compressed files (bug introduced in 1.11.0).
 
 
 Maintenance
@@ -20,6 +21,7 @@
 * SQLite now closes and deletes WAL and SHM files on exit.  This should improve
   handling of SQLite DB over network drives.
 
+
 Version 1.11.1 (2022-06-30)
 ===========================
 
--- a/OrthancFramework/Sources/FileStorage/StorageAccessor.cpp	Wed Aug 03 10:49:50 2022 +0200
+++ b/OrthancFramework/Sources/FileStorage/StorageAccessor.cpp	Mon Aug 08 09:59:07 2022 +0200
@@ -269,17 +269,7 @@
                                     const FileInfo& info,
                                     const std::string& mime)
   {
-    if (cache_ == NULL || !cache_->Fetch(sender.GetBuffer(), info.GetUuid(), info.GetContentType()))
-    {
-      MetricsTimer timer(*this, METRICS_READ);
-      std::unique_ptr<IMemoryBuffer> buffer(area_.Read(info.GetUuid(), info.GetContentType()));
-      buffer->MoveToString(sender.GetBuffer());
-
-      if (cache_ != NULL)
-      {
-        cache_->Add(info.GetUuid(), info.GetContentType(), sender.GetBuffer());
-      }
-    }
+    Read(sender.GetBuffer(), info);
 
     sender.SetContentType(mime);
 
@@ -323,7 +313,7 @@
     BufferHttpSender sender;
     SetupSender(sender, info, mime);
   
-    HttpStreamTranscoder transcoder(sender, info.GetCompressionType());
+    HttpStreamTranscoder transcoder(sender, CompressionType_None); // since 1.11.2, the storage accessor only returns uncompressed buffers
     output.Answer(transcoder);
   }
 #endif
@@ -347,7 +337,7 @@
     BufferHttpSender sender;
     SetupSender(sender, info, mime);
   
-    HttpStreamTranscoder transcoder(sender, info.GetCompressionType());
+    HttpStreamTranscoder transcoder(sender, CompressionType_None); // since 1.11.2, the storage accessor only returns uncompressed buffers
     output.AnswerStream(transcoder);
   }
 #endif