Mercurial > hg > orthanc-dicomweb
changeset 6:e0ec2d417534
robustness to line feeds
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 15 Mar 2015 10:42:42 +0100 |
parents | 3ec1e035c84f |
children | 10a35ea52161 |
files | Core/Toolbox.cpp Plugin/StowRs.cpp Samples/JavaScript/stow-rs.js |
diffstat | 3 files changed, 5 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/Toolbox.cpp Sat Mar 14 16:43:38 2015 +0100 +++ b/Core/Toolbox.cpp Sun Mar 15 10:42:42 2015 +0100 @@ -157,7 +157,7 @@ { result.clear(); - boost::regex header("(\n?)--" + boundary + "(--|.*\n\n)"); + boost::regex header("\r?(\n?)--" + boundary + "(--|.*\r?\n\r?\n)"); boost::regex pattern(".*^Content-Type\\s*:\\s*([^\\s]*).*", boost::regex::icase /* case insensitive */);
--- a/Plugin/StowRs.cpp Sat Mar 14 16:43:38 2015 +0100 +++ b/Plugin/StowRs.cpp Sun Mar 15 10:42:42 2015 +0100 @@ -152,12 +152,6 @@ gdcm::SmartPointer<gdcm::SequenceOfItems> success = new gdcm::SequenceOfItems(); gdcm::SmartPointer<gdcm::SequenceOfItems> failed = new gdcm::SequenceOfItems(); - { - FILE* fp=fopen("tutu.dcm", "wb"); - fwrite(request->body, 1, request->bodySize, fp); - fclose(fp); - } - std::vector<OrthancPlugins::MultipartItem> items; OrthancPlugins::ParseMultipartBody(items, request->body, request->bodySize, boundary); for (size_t i = 0; i < items.size(); i++)
--- a/Samples/JavaScript/stow-rs.js Sat Mar 14 16:43:38 2015 +0100 +++ b/Samples/JavaScript/stow-rs.js Sun Mar 15 10:42:42 2015 +0100 @@ -42,8 +42,8 @@ function ConstructMultipart(body, contentType) { - var header = '--' + BOUNDARY + '\nContent-Type: ' + contentType + '\n\n'; - var trailer = '\n--' + BOUNDARY + '--\n'; + var header = '--' + BOUNDARY + '\r\nContent-Type: ' + contentType + '\r\n\r\n'; + var trailer = '\r\n--' + BOUNDARY + '--\r\n'; header = StringToArrayBuffer(header); trailer = StringToArrayBuffer(trailer); @@ -78,7 +78,8 @@ processData: false, // Very important! dataType: 'json', success: function(resp) { - alert('Upload was a success!'); + count = resp['00081199'].Value.length; + alert('Upload was a success! ' + count + ' instance was uploaded.'); }, error: function() { alert('Cannot process this query');