Pārlūkot izejas kodu

Bug 1659: Relative long paths are not handled correctly

https://winscp.net/tracker/1659

Source commit: 20c5802e3fa677c83e78bc3cb37fa1b46a63bdf2
Martin Prikryl 7 gadi atpakaļ
vecāks
revīzija
1f21f57f30
1 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 7 0
      source/core/Common.cpp

+ 7 - 0
source/core/Common.cpp

@@ -1144,6 +1144,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)