diff OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 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 52217dc47a4e
children 46061a91c88a
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()))
     {