diff OrthancServer/OrthancRestApi.cpp @ 155:93e1b0e3b83a

filenames when downloading json/dicom
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 23 Oct 2012 15:43:46 +0200
parents 11e48e70c039
children da7e915202c7 8e673a65564d
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp	Tue Oct 23 15:12:40 2012 +0200
+++ b/OrthancServer/OrthancRestApi.cpp	Tue Oct 23 15:43:46 2012 +0200
@@ -566,17 +566,19 @@
               uri[2] == "tags" || 
               uri[2] == "simplified-tags"))
     {
-      std::string fileUuid, contentType;
+      std::string fileUuid, contentType, filename;
       if (uri[2] == "file")
       {
         existingResource = index_.GetDicomFile(fileUuid, uri[1]);
         contentType = "application/dicom";
+        filename = fileUuid + ".dcm";
       }
       else if (uri[2] == "tags" ||
                uri[2] == "simplified-tags")
       {
         existingResource = index_.GetJsonFile(fileUuid, uri[1]);
         contentType = "application/json";
+        filename = fileUuid + ".json";
       }
 
       if (existingResource)
@@ -590,7 +592,7 @@
         }
         else
         {
-          output.AnswerFile(storage_, fileUuid, contentType);
+          output.AnswerFile(storage_, fileUuid, contentType, filename.c_str());
           return;
         }
       }