# HG changeset patch # User Sebastien Jodogne # Date 1680875052 -7200 # Node ID eb2684260c1915c504c3692ffb6eacaafffbfa09 # Parent b36f82260f417df7160c6de2c907e31574a4c0a9 support labels for mysql diff -r b36f82260f41 -r eb2684260c19 NEWS --- a/NEWS Fri Apr 07 12:20:53 2023 +0200 +++ b/NEWS Fri Apr 07 15:44:12 2023 +0200 @@ -25,6 +25,7 @@ Orthanc Explorer ---------------- +* Added support for labels * Added buttons to copy the URL of ZIP archives and DICOM files to the clipboard Maintenance diff -r b36f82260f41 -r eb2684260c19 OrthancServer/OrthancExplorer/explorer.html --- a/OrthancServer/OrthancExplorer/explorer.html Fri Apr 07 12:20:53 2023 +0200 +++ b/OrthancServer/OrthancExplorer/explorer.html Fri Apr 07 15:44:12 2023 +0200 @@ -434,8 +434,8 @@ Before modification
  • Download the DICOM file
  • -
  • Copy link to the DICOM file
  • Download the JSON file
  • +
  • Copy link to the DICOM file
  • Preview the instance
  • diff -r b36f82260f41 -r eb2684260c19 OrthancServer/Sources/ServerToolbox.cpp --- a/OrthancServer/Sources/ServerToolbox.cpp Fri Apr 07 12:20:53 2023 +0200 +++ b/OrthancServer/Sources/ServerToolbox.cpp Fri Apr 07 15:44:12 2023 +0200 @@ -295,6 +295,13 @@ { return false; } + + if (label.size() > 64) + { + // This limitation is for MySQL, which cannot use a TEXT + // column of undefined length as a primary key + return false; + } for (size_t i = 0; i < label.size(); i++) { @@ -319,7 +326,8 @@ { throw OrthancException(ErrorCode_ParameterOutOfRange, "A label must be a non-empty, alphanumeric string, " - "possibly with '.', '_', or '-' characters, but got: " + label); + "possibly with '.', '_', or '-' characters, " + "with maximum 64 characters, but got: " + label); } } } diff -r b36f82260f41 -r eb2684260c19 OrthancServer/UnitTestsSources/ServerIndexTests.cpp --- a/OrthancServer/UnitTestsSources/ServerIndexTests.cpp Fri Apr 07 12:20:53 2023 +0200 +++ b/OrthancServer/UnitTestsSources/ServerIndexTests.cpp Fri Apr 07 15:44:12 2023 +0200 @@ -1045,8 +1045,8 @@ TEST(ServerToolbox, ValidLabels) { ASSERT_TRUE(ServerToolbox::IsValidLabel("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789-_.")); + "ABCDEFGHIJKLMNOPQRSTUVWXYZ")); + ASSERT_TRUE(ServerToolbox::IsValidLabel("0123456789-_.")); ASSERT_FALSE(ServerToolbox::IsValidLabel("")); ASSERT_FALSE(ServerToolbox::IsValidLabel(" ")); ASSERT_FALSE(ServerToolbox::IsValidLabel("&"));