Mercurial > hg > orthanc
comparison OrthancServer/ParsedDicomFile.cpp @ 1981:4b545a8b1f95
return code in Toolbox::DecodeDataUriScheme
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 22 Apr 2016 09:05:06 +0200 |
parents | ebce5f456b8e |
children | b5d4f9c156ad |
comparison
equal
deleted
inserted
replaced
1980:ebce5f456b8e | 1981:4b545a8b1f95 |
---|---|
633 | 633 |
634 if (decodeDataUriScheme && | 634 if (decodeDataUriScheme && |
635 boost::starts_with(utf8Value, "data:application/octet-stream;base64,")) | 635 boost::starts_with(utf8Value, "data:application/octet-stream;base64,")) |
636 { | 636 { |
637 std::string mime; | 637 std::string mime; |
638 Toolbox::DecodeDataUriScheme(mime, binary, utf8Value); | 638 if (!Toolbox::DecodeDataUriScheme(mime, binary, utf8Value)) |
639 { | |
640 throw OrthancException(ErrorCode_BadFileFormat); | |
641 } | |
642 | |
639 decoded = &binary; | 643 decoded = &binary; |
640 } | 644 } |
641 else | 645 else |
642 { | 646 { |
643 Encoding encoding = GetEncoding(); | 647 Encoding encoding = GetEncoding(); |
909 | 913 |
910 | 914 |
911 void ParsedDicomFile::EmbedContent(const std::string& dataUriScheme) | 915 void ParsedDicomFile::EmbedContent(const std::string& dataUriScheme) |
912 { | 916 { |
913 std::string mime, content; | 917 std::string mime, content; |
914 Toolbox::DecodeDataUriScheme(mime, content, dataUriScheme); | 918 if (!Toolbox::DecodeDataUriScheme(mime, content, dataUriScheme)) |
919 { | |
920 throw OrthancException(ErrorCode_BadFileFormat); | |
921 } | |
922 | |
915 Toolbox::ToLowerCase(mime); | 923 Toolbox::ToLowerCase(mime); |
916 | 924 |
917 if (mime == "image/png" || | 925 if (mime == "image/png" || |
918 mime == "image/jpeg") | 926 mime == "image/jpeg") |
919 { | 927 { |