changeset 2704:b71c59312bae

fix MIME type for PAM images
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Jul 2018 15:18:53 +0200
parents f77c7b48f798
children 5c18a22cb981
files OrthancServer/OrthancRestApi/OrthancRestResources.cpp
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Thu Jul 05 21:02:50 2018 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Fri Jul 06 15:18:53 2018 +0200
@@ -366,7 +366,15 @@
 
       void EncodeUsingPam()
       {
-        format_ = "image/pam";
+        /**
+         * "No Internet Media Type (aka MIME type, content type) for
+         * PBM has been registered with IANA, but the unofficial value
+         * image/x-portable-arbitrarymap is assigned by this
+         * specification, to be consistent with conventional values
+         * for the older Netpbm formats."
+         * http://netpbm.sourceforge.net/doc/pam.html
+         **/
+        format_ = "image/x-portable-arbitrarymap";
         DicomImageDecoder::ExtractPamImage(answer_, image_, mode_, invert_);
       }
 
@@ -549,9 +557,14 @@
     ImageToEncode image(decoded, mode, invert);
 
     HttpContentNegociation negociation;
-    EncodePng png(image);          negociation.Register("image/png", png);
-    EncodeJpeg jpeg(image, call);  negociation.Register("image/jpeg", jpeg);
-    EncodePam pam(image);          negociation.Register("image/pam", pam);
+    EncodePng png(image);
+    negociation.Register("image/png", png);
+
+    EncodeJpeg jpeg(image, call);
+    negociation.Register("image/jpeg", jpeg);
+
+    EncodePam pam(image);
+    negociation.Register("image/x-portable-arbitrarymap", pam);
 
     if (negociation.Apply(call.GetHttpHeaders()))
     {