소스 검색

Bug 1992: When handling URL in an existing WinSCP instance, session settings from a stored site named after the URL hostname are not used

https://winscp.net/tracker/1992

Source commit: ebf8d40bcf8cacc75b216c84c17086c25c56fef8
Martin Prikryl 4 년 전
부모
커밋
a2913d8d79
3개의 변경된 파일12개의 추가작업 그리고 5개의 파일을 삭제
  1. 3 2
      source/forms/CustomScpExplorer.cpp
  2. 1 0
      source/windows/WinInterface.h
  3. 8 3
      source/windows/WinMain.cpp

+ 3 - 2
source/forms/CustomScpExplorer.cpp

@@ -505,10 +505,11 @@ bool __fastcall TCustomScpExplorerForm::CommandLineFromAnotherInstance(
       StoredSessions->Reload();
       UnicodeString SessionName = Params.Param[1];
       std::unique_ptr<TObjectList> DataList(new TObjectList());
-      UnicodeString DownloadFile; // unused
       try
       {
-        GetLoginData(SessionName, &Params, DataList.get(), DownloadFile, true, this);
+        UnicodeString DownloadFile; // unused
+        int Flags = GetCommandLineParseUrlFlags(&Params);
+        GetLoginData(SessionName, &Params, DataList.get(), DownloadFile, true, this, Flags);
       }
       catch (EAbort &)
       {

+ 1 - 0
source/windows/WinInterface.h

@@ -170,6 +170,7 @@ bool __fastcall DoChangeMasterPasswordDialog(UnicodeString & NewPassword);
 int __fastcall Execute();
 void __fastcall GetLoginData(UnicodeString SessionName, TOptions * Options,
   TObjectList * DataList, UnicodeString & DownloadFile, bool NeedSession, TForm * LinkedForm, int Flags = 0);
+int GetCommandLineParseUrlFlags(TProgramParams * Params);
 
 // forms\InputDlg.cpp
 struct TInputDialogData

+ 8 - 3
source/windows/WinMain.cpp

@@ -93,6 +93,13 @@ void __fastcall GetLoginData(UnicodeString SessionName, TOptions * Options,
   }
 }
 //---------------------------------------------------------------------------
+int GetCommandLineParseUrlFlags(TProgramParams * Params)
+{
+  return
+    pufAllowStoredSiteWithProtocol |
+    FLAGMASK(!CheckSafe(Params), pufUnsafe);
+}
+//---------------------------------------------------------------------------
 void __fastcall Upload(TTerminal * Terminal, TStrings * FileList, int UseDefaults)
 {
   UnicodeString TargetDirectory;
@@ -1134,9 +1141,7 @@ int __fastcall Execute()
         std::unique_ptr<TObjectList> DataList(new TObjectList());
         try
         {
-          int Flags =
-            pufAllowStoredSiteWithProtocol |
-            FLAGMASK(!CheckSafe(Params), pufUnsafe);
+          int Flags = GetCommandLineParseUrlFlags(Params);
           GetLoginData(AutoStartSession, Params, DataList.get(), DownloadFile, NeedSession, NULL, Flags);
           // GetLoginData now Aborts when session is needed and none is selected
           if (DebugAlwaysTrue(!NeedSession || (DataList->Count > 0)))