Ver código fonte

HPCC-11571 Files with spaces in the name give errors from eclwatch

Spaces (and a few other chars) need escaping when creating xpath for superfile
lock

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 anos atrás
pai
commit
6f146cfe96
1 arquivos alterados com 6 adições e 1 exclusões
  1. 6 1
      dali/base/dautils.cpp

+ 6 - 1
dali/base/dautils.cpp

@@ -895,6 +895,7 @@ StringBuffer &CDfsLogicalFileName::makeFullnameQuery(StringBuffer &query, DfsXml
 StringBuffer &CDfsLogicalFileName::makeXPathLName(StringBuffer &lfnNodeName) const
 {
     const char *s=get(true);    // skip foreign
+    // Ensure only chars that are accepted by jptree in an xpath element are used
     bool first=true;
     loop
     {
@@ -919,7 +920,11 @@ StringBuffer &CDfsLogicalFileName::makeXPathLName(StringBuffer &lfnNodeName) con
                     c = toupper(*s);
                     // fall through
                 default:
-                    lfnNodeName.append(c);
+                    if (isalnum(c))
+                        lfnNodeName.append(c);
+                    else
+                        lfnNodeName.append('_').append((unsigned) (unsigned char) c);
+                    break;
                 }
                 ++s;
             }