comparison 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
comparison
equal deleted inserted replaced
154:66c2605532b3 155:93e1b0e3b83a
564 uri[0] == "instances" && 564 uri[0] == "instances" &&
565 (uri[2] == "file" || 565 (uri[2] == "file" ||
566 uri[2] == "tags" || 566 uri[2] == "tags" ||
567 uri[2] == "simplified-tags")) 567 uri[2] == "simplified-tags"))
568 { 568 {
569 std::string fileUuid, contentType; 569 std::string fileUuid, contentType, filename;
570 if (uri[2] == "file") 570 if (uri[2] == "file")
571 { 571 {
572 existingResource = index_.GetDicomFile(fileUuid, uri[1]); 572 existingResource = index_.GetDicomFile(fileUuid, uri[1]);
573 contentType = "application/dicom"; 573 contentType = "application/dicom";
574 filename = fileUuid + ".dcm";
574 } 575 }
575 else if (uri[2] == "tags" || 576 else if (uri[2] == "tags" ||
576 uri[2] == "simplified-tags") 577 uri[2] == "simplified-tags")
577 { 578 {
578 existingResource = index_.GetJsonFile(fileUuid, uri[1]); 579 existingResource = index_.GetJsonFile(fileUuid, uri[1]);
579 contentType = "application/json"; 580 contentType = "application/json";
581 filename = fileUuid + ".json";
580 } 582 }
581 583
582 if (existingResource) 584 if (existingResource)
583 { 585 {
584 if (uri[2] == "simplified-tags") 586 if (uri[2] == "simplified-tags")
588 SendJson(output, v); 590 SendJson(output, v);
589 return; 591 return;
590 } 592 }
591 else 593 else
592 { 594 {
593 output.AnswerFile(storage_, fileUuid, contentType); 595 output.AnswerFile(storage_, fileUuid, contentType, filename.c_str());
594 return; 596 return;
595 } 597 }
596 } 598 }
597 } 599 }
598 600