# HG changeset patch # User Sebastien Jodogne # Date 1354192053 -3600 # Node ID 0200cd330582f448094adfacd6a6a06367d49929 # Parent 1ac3aacd10a5d9c8ca1b66fbf9bf935fb828ef28 fixes diff -r 1ac3aacd10a5 -r 0200cd330582 Core/RestApi/RestApiPath.cpp --- 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; } diff -r 1ac3aacd10a5 -r 0200cd330582 OrthancServer/DatabaseWrapper.cpp --- 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()); diff -r 1ac3aacd10a5 -r 0200cd330582 OrthancServer/OrthancRestApi2.cpp --- 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"); } } } diff -r 1ac3aacd10a5 -r 0200cd330582 UnitTests/ServerIndex.cpp --- 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"));