瀏覽代碼

Bug fix: When saving a site with a slash in the username, it is misinterpreted as a site folder

Source commit: 1fcd93d3772d1a867bb8c88a9532737188955d29
Martin Prikryl 4 年之前
父節點
當前提交
a4e7ae98ff
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      source/core/SessionData.cpp

+ 7 - 4
source/core/SessionData.cpp

@@ -3067,27 +3067,30 @@ void __fastcall TSessionData::SetRekeyTime(unsigned int value)
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
 UnicodeString __fastcall TSessionData::GetDefaultSessionName()
 UnicodeString __fastcall TSessionData::GetDefaultSessionName()
 {
 {
+  UnicodeString Result;
   if (IsLocalBrowser)
   if (IsLocalBrowser)
   {
   {
     // See also TScpCommanderForm::GetLocalBrowserSessionTitle
     // See also TScpCommanderForm::GetLocalBrowserSessionTitle
     UnicodeString Path1 = ExtractShortName(LocalDirectory, false);
     UnicodeString Path1 = ExtractShortName(LocalDirectory, false);
     UnicodeString Path2 = ExtractShortName(OtherLocalDirectory, false);
     UnicodeString Path2 = ExtractShortName(OtherLocalDirectory, false);
-    return Path1 + TitleSeparator + Path2;
+    Result = Path1 + TitleSeparator + Path2;
   }
   }
   else if (!HostName.IsEmpty() && !UserName.IsEmpty())
   else if (!HostName.IsEmpty() && !UserName.IsEmpty())
   {
   {
     // If we ever choose to include port number,
     // If we ever choose to include port number,
     // we have to escape IPv6 literals in HostName
     // we have to escape IPv6 literals in HostName
-    return FORMAT(L"%s@%s", (UserName, HostName));
+    Result = FORMAT(L"%s@%s", (UserName, HostName));
   }
   }
   else if (!HostName.IsEmpty())
   else if (!HostName.IsEmpty())
   {
   {
-    return HostName;
+    Result = HostName;
   }
   }
   else
   else
   {
   {
-    return L"session";
+    Result = L"session";
   }
   }
+  Result = MakeValidName(Result);
+  return Result;
 }
 }
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
 UnicodeString __fastcall TSessionData::GetNameWithoutHiddenPrefix()
 UnicodeString __fastcall TSessionData::GetNameWithoutHiddenPrefix()