Explorar o código

Bug 1659: Relative long paths are not handled correctly

https://winscp.net/tracker/1659
(cherry picked from commit 1f21f57f30a3f8d06d246599c1b05d76ee98123d)

Source commit: 7de846c8437665adda6a8e5bb8cb071534528cb1
Martin Prikryl %!s(int64=7) %!d(string=hai) anos
pai
achega
df0b55bb97
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      source/core/Common.cpp

+ 7 - 0
source/core/Common.cpp

@@ -1110,6 +1110,13 @@ UnicodeString __fastcall MakeUnicodeLargePath(UnicodeString Path)
 //---------------------------------------------------------------------------
 UnicodeString __fastcall ApiPath(UnicodeString Path)
 {
+  UnicodeString Drive = ExtractFileDrive(Path);
+  // This may match even a path like "C:" or "\\server\\share", but we do not really care
+  if (Drive.IsEmpty() || (Path.SubString(Drive.Length() + 1, 1) != L"\\"))
+  {
+    Path = ExpandFileName(Path);
+  }
+
   if (Path.Length() >= MAX_PATH)
   {
     if (Configuration != NULL)