changeset 4989:24ef02dc7a7a

merge
author Alain Mazy <am@osimis.io>
date Sat, 30 Apr 2022 19:40:52 +0200
parents 8fba26292a9f (current diff) 48b53ac404d9 (diff)
children b1fe3b44ce1d
files NEWS
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Sat Apr 30 19:39:40 2022 +0200
+++ b/NEWS	Sat Apr 30 19:40:52 2022 +0200
@@ -52,6 +52,8 @@
   - "MainDicomTags" to list the tags that are saved in DB
   - "StorageCompression", "OverwriteInstances", "IngestTranscoding" reported from the 
     configuration file
+* New option "filename" in "/.../{id}/archive" and "/.../{id}/media" to
+  manually set the filename in the "Content-Disposition" HTTP header
 
 
 Version 1.10.1 (2022-03-23)
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp	Sat Apr 30 19:39:40 2022 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp	Sat Apr 30 19:40:52 2022 +0200
@@ -580,6 +580,7 @@
   static void CreateSingleGet(RestApiGetCall& call)
   {
     static const char* const TRANSCODE = "transcode";
+    static const char* const FILENAME = "filename";
 
     if (call.IsDocumentation())
     {
@@ -594,6 +595,9 @@
                         "which might *not* be desirable to archive large amount of data, as it might "
                         "lead to network timeouts. Prefer the asynchronous version using `POST` method.")
         .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest")
+        .SetHttpGetArgument(FILENAME, RestApiCallDocumentation::Type_String,
+                            "Filename to set in the \"Content-Disposition\" HTTP header "
+                            "(including file extension)", false)
         .SetHttpGetArgument(TRANSCODE, RestApiCallDocumentation::Type_String,
                             "If present, the DICOM files in the archive will be transcoded to the provided "
                             "transfer syntax: https://book.orthanc-server.com/faq/transcoding.html", false)
@@ -609,7 +613,8 @@
 
     ServerContext& context = OrthancRestApi::GetContext(call);
 
-    std::string id = call.GetUriComponent("id", "");
+    const std::string id = call.GetUriComponent("id", "");
+    const std::string filename = call.GetArgument(FILENAME, id + ".zip");  // New in Orthanc 1.11.0
 
     bool extended;
     if (IS_MEDIA)
@@ -636,7 +641,7 @@
     }
 
     SubmitJob(call.GetOutput(), context, job, 0 /* priority */,
-              true /* synchronous */, id + ".zip");
+              true /* synchronous */, filename);
   }