Skip to content

Commit

Permalink
throw in IBooker::bookME when illegal characters for the DQM GUI uplo…
Browse files Browse the repository at this point in the history
…ad are encountered
  • Loading branch information
mmusich committed Jul 22, 2022
1 parent 89e207c commit 1d0e439
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions DQMServices/Core/src/DQMStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

namespace dqm::implementation {

// list of acceptable characters for ME path names, in order to be able to upload to the CMS DQM GUI
// See https://github.com/cms-DQM/dqmgui_prod/blob/af0a388e8f57c60e51111585d298aeeea943367f/src/cpp/DQM/DQMStore.cc#L56
static const std::string s_safe = "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# ";

std::string NavigatorBase::pwd() {
if (cwd_.empty()) {
return "";
Expand Down Expand Up @@ -66,6 +70,13 @@ namespace dqm::implementation {
bool forceReplace /* = false */) {
MonitorElementData::Path path;
std::string fullpath = cwd_ + std::string(name.View());

if (fullpath.find_first_not_of(s_safe) != std::string::npos) {
throw cms::Exception("BadMonitorElementPathName")
<< " Monitor element path name: '" << fullpath.c_str() << "' uses unacceptable characters."
<< "\n Acceptable characters are: " << s_safe.c_str();
}

path.set(fullpath, MonitorElementData::Path::Type::DIR_AND_NAME);

// We should check if there is a local ME for this module and name already.
Expand Down

0 comments on commit 1d0e439

Please sign in to comment.