Mercurial > hg > orthanc
changeset 218:0200cd330582
fixes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2012 13:27:33 +0100 |
parents | 1ac3aacd10a5 |
children | 5459f05b4f54 |
files | Core/RestApi/RestApiPath.cpp OrthancServer/DatabaseWrapper.cpp OrthancServer/OrthancRestApi2.cpp UnitTests/ServerIndex.cpp |
diffstat | 4 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/RestApi/RestApiPath.cpp Thu Nov 29 12:22:23 2012 +0100 +++ b/Core/RestApi/RestApiPath.cpp Thu Nov 29 13:27:33 2012 +0100 @@ -42,6 +42,7 @@ if (uri_.size() == 0) { + hasTrailing_ = false; return; }
--- a/OrthancServer/DatabaseWrapper.cpp Thu Nov 29 12:22:23 2012 +0100 +++ b/OrthancServer/DatabaseWrapper.cpp Thu Nov 29 13:27:33 2012 +0100 @@ -576,7 +576,11 @@ sprintf(buf, "SELECT COUNT(*) FROM %s", table.c_str()); SQLite::Statement s(db_, buf); - assert(s.Step()); + if (!s.Step()) + { + throw OrthancException(ErrorCode_InternalError); + } + int64_t c = s.ColumnInt(0); assert(!s.Step());
--- a/OrthancServer/OrthancRestApi2.cpp Thu Nov 29 12:22:23 2012 +0100 +++ b/OrthancServer/OrthancRestApi2.cpp Thu Nov 29 13:27:33 2012 +0100 @@ -256,15 +256,18 @@ FromDcmtkBridge::ExtractPngImage(png, dicomContent, frame, mode); call.GetOutput().AnswerBuffer(png, "image/png"); } - catch (OrthancException&) + catch (OrthancException& e) { - std::string root = ""; - for (size_t i = 1; i < call.GetFullUri().size(); i++) + if (e.GetErrorCode() == ErrorCode_NotImplemented) { - root += "../"; + std::string root = ""; + for (size_t i = 1; i < call.GetFullUri().size(); i++) + { + root += "../"; + } + + call.GetOutput().Redirect(root + "app/images/unsupported.png"); } - - call.GetOutput().Redirect(root + "app/images/unsupported.png"); } } }
--- a/UnitTests/ServerIndex.cpp Thu Nov 29 12:22:23 2012 +0100 +++ b/UnitTests/ServerIndex.cpp Thu Nov 29 13:27:33 2012 +0100 @@ -164,7 +164,7 @@ ASSERT_EQ(CompressionType_Zlib, ct); ASSERT_EQ(0u, listener.deletedFiles_.size()); - ASSERT_EQ(7, index.GetTableRecordCount("Resources")); + ASSERT_EQ(7, index.GetTableRecordCount("Resources")); ASSERT_EQ(3, index.GetTableRecordCount("AttachedFiles")); ASSERT_EQ(1, index.GetTableRecordCount("Metadata")); ASSERT_EQ(1, index.GetTableRecordCount("MainDicomTags"));