Explorar o código

HPCC-15428 CLocalEnvironment doesn't check properly the drop zone path in
getDropZoneByAddressPath() function.

Add path separator character at the end of the drop zone path (if there
is not any) before compare it to the target file path.

Signed-off-by: Attila Vamos <attila.vamos@gmail.com>

Attila Vamos %!s(int64=9) %!d(string=hai) anos
pai
achega
a24674333a
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      common/environment/environment.cpp

+ 5 - 4
common/environment/environment.cpp

@@ -1576,12 +1576,13 @@ IConstDropZoneInfo * CLocalEnvironment::getDropZoneByAddressPath(const char * ne
 
     ForEach(*zoneIt)
     {
-        SCMStringBuffer dropZoneName;
-        zoneIt->query().getName(dropZoneName);
-
         SCMStringBuffer dropZoneDir;
         zoneIt->query().getDirectory(dropZoneDir);
-        const char * pdropzoneDir = dropZoneDir.str();
+        StringBuffer fullDropZoneDir(dropZoneDir.str());
+        const char pathSeparator = fullDropZoneDir.charAt(0);
+        if (fullDropZoneDir.charAt(fullDropZoneDir.length()) != pathSeparator)
+            fullDropZoneDir.append(pathSeparator);
+        const char * pdropzoneDir = fullDropZoneDir.str();
 
         // Check target file path starts with this Drop zone path
         // the drop zone paths can be nested (nothing forbids it) like