changeset 3435:c08bb6ac3b7f

new mime type: font/woff2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Jun 2019 12:31:59 +0200
parents 6503ab9489ba
children 64eafed9418a 8c663bbe5363
files Core/Enumerations.cpp Core/Enumerations.h Core/SystemToolbox.cpp UnitTestsSources/UnitTestsMain.cpp
diffstat 4 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Enumerations.cpp	Tue Jun 18 11:37:18 2019 +0200
+++ b/Core/Enumerations.cpp	Wed Jun 19 12:31:59 2019 +0200
@@ -57,6 +57,7 @@
   static const char* const MIME_SVG = "image/svg+xml";
   static const char* const MIME_WEB_ASSEMBLY = "application/wasm";
   static const char* const MIME_WOFF = "application/x-font-woff";
+  static const char* const MIME_WOFF2 = "font/woff2";
   static const char* const MIME_XML_2 = "text/xml";
   static const char* const MIME_ZIP = "application/zip";
   static const char* const MIME_DICOM_WEB_JSON = "application/dicom+json";
@@ -1121,6 +1122,9 @@
       case MimeType_Woff:
         return MIME_WOFF;
 
+      case MimeType_Woff2:
+        return MIME_WOFF2;
+
       case MimeType_PrometheusText:
         // https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format
         return "text/plain; version=0.0.4";
@@ -1754,6 +1758,10 @@
     {
       return MimeType_Woff;
     }
+    else if (mime == MIME_WOFF2)
+    {
+      return MimeType_Woff2;
+    }
     else if (mime == MIME_DICOM_WEB_JSON)
     {
       return MimeType_DicomWebJson;
--- a/Core/Enumerations.h	Tue Jun 18 11:37:18 2019 +0200
+++ b/Core/Enumerations.h	Wed Jun 19 12:31:59 2019 +0200
@@ -121,6 +121,7 @@
     MimeType_WebAssembly,
     MimeType_Xml,
     MimeType_Woff,            // Web Open Font Format
+    MimeType_Woff2,
     MimeType_Zip,
     MimeType_PrometheusText,  // Prometheus text-based exposition format (for metrics)
     MimeType_DicomWebJson,
--- a/Core/SystemToolbox.cpp	Tue Jun 18 11:37:18 2019 +0200
+++ b/Core/SystemToolbox.cpp	Wed Jun 19 12:31:59 2019 +0200
@@ -699,6 +699,10 @@
     {
       return MimeType_Woff;
     }
+    else if (extension == ".woff2")
+    {
+      return MimeType_Woff2;
+    }
 
     // Default type
     else
--- a/UnitTestsSources/UnitTestsMain.cpp	Tue Jun 18 11:37:18 2019 +0200
+++ b/UnitTestsSources/UnitTestsMain.cpp	Wed Jun 19 12:31:59 2019 +0200
@@ -332,6 +332,7 @@
   ASSERT_EQ(MimeType_PNaCl, SystemToolbox::AutodetectMimeType("NOTES.pexe"));
   ASSERT_EQ(MimeType_Svg, SystemToolbox::AutodetectMimeType("NOTES.svg"));
   ASSERT_EQ(MimeType_Woff, SystemToolbox::AutodetectMimeType("NOTES.woff"));
+  ASSERT_EQ(MimeType_Woff2, SystemToolbox::AutodetectMimeType("NOTES.woff2"));
 
   // Test primitives from the "RegisterDefaultExtensions()" that was
   // present in the sample "Serve Folders plugin" of Orthanc 1.4.2
@@ -344,6 +345,7 @@
   ASSERT_STREQ("application/x-nacl", EnumerationToString(SystemToolbox::AutodetectMimeType(".nexe")));
   ASSERT_STREQ("application/x-pnacl", EnumerationToString(SystemToolbox::AutodetectMimeType(".pexe")));
   ASSERT_STREQ("application/xml", EnumerationToString(SystemToolbox::AutodetectMimeType(".xml")));
+  ASSERT_STREQ("font/woff2", EnumerationToString(SystemToolbox::AutodetectMimeType(".woff2")));
   ASSERT_STREQ("image/gif", EnumerationToString(SystemToolbox::AutodetectMimeType(".gif")));
   ASSERT_STREQ("image/jpeg", EnumerationToString(SystemToolbox::AutodetectMimeType(".jpeg")));
   ASSERT_STREQ("image/jpeg", EnumerationToString(SystemToolbox::AutodetectMimeType(".jpg")));