Просмотр исходного кода

Merge pull request #12584 from wangkx/h22208

HPCC-22208 Ensure correct file path for WsFileIO

Reviewed-By: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 6 лет назад
Родитель
Сommit
47be5ef74a
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      esp/services/ws_fileio/ws_fileioservice.cpp

+ 10 - 4
esp/services/ws_fileio/ws_fileioservice.cpp

@@ -93,15 +93,21 @@ bool CWsFileIOEx::CheckServerAccess(const char* targetDZNameOrAddress, const cha
         dropZoneInfo->getDirectory(directory);
         if (directory.length() != 0)
         {
-            const char ch = getPathSepChar(directory.str());
-            if (relPath[0] != ch)
+            absPath.set(directory.str());
+
+            char absPathLastChar = absPath.charAt(absPath.length() - 1);
+            const char pathSepChar = getPathSepChar(directory.str());
+            if (relPath[0] != pathSepChar)
             {
-                absPath.appendf("%s%c%s", directory.str(), ch, relPath);
+                if (absPathLastChar != pathSepChar)
+                    absPath.append(pathSepChar);
             }
             else
             {
-                absPath.appendf("%s%s", directory.str(), relPath);
+                if (absPathLastChar == pathSepChar)
+                    absPath.setLength(absPath.length() - 1);
             }
+            absPath.append(relPath);
             return true;
         }
         else