浏览代码

Bug 1659: Relative long paths are not handled correctly

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

Source commit: 7de846c8437665adda6a8e5bb8cb071534528cb1
Martin Prikryl 7 年之前
父节点
当前提交
df0b55bb97
共有 1 个文件被更改,包括 7 次插入0 次删除
  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)