Mercurial > hg > orthanc
changeset 6909:3417bcf097a0 streaming
fix handling of content range
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Tue, 02 Jun 2026 15:03:11 +0200 |
| parents | 029233bb06c4 |
| children | 89677acd8f8d |
| files | OrthancFramework/Sources/FileStorage/StorageRange.cpp OrthancFramework/Sources/Toolbox.cpp OrthancFramework/UnitTestsSources/ToolboxTests.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp |
| diffstat | 4 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/FileStorage/StorageRange.cpp Tue Jun 02 14:41:38 2026 +0200 +++ b/OrthancFramework/Sources/FileStorage/StorageRange.cpp Tue Jun 02 15:03:11 2026 +0200 @@ -245,6 +245,10 @@ { range.SetStartInclusive(tmp); } + else + { + throw OrthancException(ErrorCode_BadRange); + } } if (!tokens[1].empty()) @@ -253,6 +257,10 @@ { range.SetEndInclusive(tmp); } + else + { + throw OrthancException(ErrorCode_BadRange); + } } range.SanityCheck();
--- a/OrthancFramework/Sources/Toolbox.cpp Tue Jun 02 14:41:38 2026 +0200 +++ b/OrthancFramework/Sources/Toolbox.cpp Tue Jun 02 15:03:11 2026 +0200 @@ -3097,7 +3097,7 @@ if (sizeInBytes < 1024) { std::ostringstream oss; - oss << sizeInBytes << "bytes"; + oss << sizeInBytes << " bytes"; return oss.str(); } else
--- a/OrthancFramework/UnitTestsSources/ToolboxTests.cpp Tue Jun 02 14:41:38 2026 +0200 +++ b/OrthancFramework/UnitTestsSources/ToolboxTests.cpp Tue Jun 02 15:03:11 2026 +0200 @@ -380,7 +380,7 @@ TEST(Toolbox, GetHumanFileSize) { - ASSERT_EQ("234bytes", Toolbox::GetHumanFileSize(234)); + ASSERT_EQ("234 bytes", Toolbox::GetHumanFileSize(234)); ASSERT_EQ("2.29KB", Toolbox::GetHumanFileSize(2345)); ASSERT_EQ("22.91KB", Toolbox::GetHumanFileSize(23456)); ASSERT_EQ("229.07KB", Toolbox::GetHumanFileSize(234567));
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Tue Jun 02 14:41:38 2026 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Tue Jun 02 15:03:11 2026 +0200 @@ -2327,7 +2327,7 @@ .AddAnswerType(MimeType_Binary, "The attachment") .SetAnswerHeader("ETag", "Revision of the attachment, to be used in further `PUT` or `DELETE` operations") .SetHttpHeader("If-None-Match", "Optional revision of the attachment, to check if its content has changed") - .SetHttpHeader("Content-Range", "Optional content range to access part of the attachment (new in Orthanc 1.12.5)"); + .SetHttpHeader("Range", "Optional content range to access part of the attachment (new in Orthanc 1.12.5)"); return; }
