changeset 4887:a29a6bdba9dd

mime type for .ico
author Alain Mazy <am@osimis.io>
date Wed, 16 Feb 2022 09:27:25 +0100
parents 228ce71e08a3
children 8523078f3f4b
files OrthancFramework/Sources/Enumerations.cpp OrthancFramework/Sources/Enumerations.h OrthancFramework/Sources/SystemToolbox.cpp OrthancFramework/UnitTestsSources/FrameworkTests.cpp
diffstat 4 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/Enumerations.cpp	Tue Feb 15 18:09:03 2022 +0100
+++ b/OrthancFramework/Sources/Enumerations.cpp	Wed Feb 16 09:27:25 2022 +0100
@@ -52,6 +52,7 @@
   static const char* const MIME_ZIP = "application/zip";
   static const char* const MIME_DICOM_WEB_JSON = "application/dicom+json";
   static const char* const MIME_DICOM_WEB_XML = "application/dicom+xml";
+  static const char* const MIME_ICO = "image/x-icon";
 
   // This function is autogenerated by the script
   // "Resources/GenerateErrorCodes.py"
@@ -1098,7 +1099,10 @@
                 
       case MimeType_DicomWebXml:
         return MIME_DICOM_WEB_XML;
-                
+
+      case MimeType_Ico:
+        return MIME_ICO;
+
       default:
         throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
@@ -1807,6 +1811,11 @@
       target = MimeType_DicomWebXml;
       return true;
     }
+    else if (source == MIME_ICO)
+    {
+      target = MimeType_Ico;
+      return true;
+    }
     else
     {
       return false;
--- a/OrthancFramework/Sources/Enumerations.h	Tue Feb 15 18:09:03 2022 +0100
+++ b/OrthancFramework/Sources/Enumerations.h	Wed Feb 16 09:27:25 2022 +0100
@@ -78,7 +78,8 @@
     MimeType_Zip,
     MimeType_PrometheusText,  // Prometheus text-based exposition format (for metrics)
     MimeType_DicomWebJson,
-    MimeType_DicomWebXml
+    MimeType_DicomWebXml,
+    MimeType_Ico
   };
 
   
--- a/OrthancFramework/Sources/SystemToolbox.cpp	Tue Feb 15 18:09:03 2022 +0100
+++ b/OrthancFramework/Sources/SystemToolbox.cpp	Wed Feb 16 09:27:25 2022 +0100
@@ -813,6 +813,10 @@
     {
       return MimeType_Woff2;
     }
+    else if (extension == ".ico")
+    {
+      return MimeType_Ico;
+    }
 
     // Default type
     else
--- a/OrthancFramework/UnitTestsSources/FrameworkTests.cpp	Tue Feb 15 18:09:03 2022 +0100
+++ b/OrthancFramework/UnitTestsSources/FrameworkTests.cpp	Wed Feb 16 09:27:25 2022 +0100
@@ -342,6 +342,7 @@
   ASSERT_EQ(MimeType_Svg, SystemToolbox::AutodetectMimeType("NOTES.svg"));
   ASSERT_EQ(MimeType_Woff, SystemToolbox::AutodetectMimeType("NOTES.woff"));
   ASSERT_EQ(MimeType_Woff2, SystemToolbox::AutodetectMimeType("NOTES.woff2"));
+  ASSERT_EQ(MimeType_Ico, SystemToolbox::AutodetectMimeType("NOTES.ico"));
 
   // Test primitives from the "RegisterDefaultExtensions()" that was
   // present in the sample "Serve Folders plugin" of Orthanc 1.4.2