Forráskód Böngészése

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 éve
szülő
commit
a2913d8d79

+ 3 - 2
source/forms/CustomScpExplorer.cpp

@@ -505,10 +505,11 @@ bool __fastcall TCustomScpExplorerForm::CommandLineFromAnotherInstance(
       StoredSessions->Reload();
       StoredSessions->Reload();
       UnicodeString SessionName = Params.Param[1];
       UnicodeString SessionName = Params.Param[1];
       std::unique_ptr<TObjectList> DataList(new TObjectList());
       std::unique_ptr<TObjectList> DataList(new TObjectList());
-      UnicodeString DownloadFile; // unused
       try
       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 &)
       catch (EAbort &)
       {
       {

+ 1 - 0
source/windows/WinInterface.h

@@ -170,6 +170,7 @@ bool __fastcall DoChangeMasterPasswordDialog(UnicodeString & NewPassword);
 int __fastcall Execute();
 int __fastcall Execute();
 void __fastcall GetLoginData(UnicodeString SessionName, TOptions * Options,
 void __fastcall GetLoginData(UnicodeString SessionName, TOptions * Options,
   TObjectList * DataList, UnicodeString & DownloadFile, bool NeedSession, TForm * LinkedForm, int Flags = 0);
   TObjectList * DataList, UnicodeString & DownloadFile, bool NeedSession, TForm * LinkedForm, int Flags = 0);
+int GetCommandLineParseUrlFlags(TProgramParams * Params);
 
 
 // forms\InputDlg.cpp
 // forms\InputDlg.cpp
 struct TInputDialogData
 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)
 void __fastcall Upload(TTerminal * Terminal, TStrings * FileList, int UseDefaults)
 {
 {
   UnicodeString TargetDirectory;
   UnicodeString TargetDirectory;
@@ -1134,9 +1141,7 @@ int __fastcall Execute()
         std::unique_ptr<TObjectList> DataList(new TObjectList());
         std::unique_ptr<TObjectList> DataList(new TObjectList());
         try
         try
         {
         {
-          int Flags =
-            pufAllowStoredSiteWithProtocol |
-            FLAGMASK(!CheckSafe(Params), pufUnsafe);
+          int Flags = GetCommandLineParseUrlFlags(Params);
           GetLoginData(AutoStartSession, Params, DataList.get(), DownloadFile, NeedSession, NULL, Flags);
           GetLoginData(AutoStartSession, Params, DataList.get(), DownloadFile, NeedSession, NULL, Flags);
           // GetLoginData now Aborts when session is needed and none is selected
           // GetLoginData now Aborts when session is needed and none is selected
           if (DebugAlwaysTrue(!NeedSession || (DataList->Count > 0)))
           if (DebugAlwaysTrue(!NeedSession || (DataList->Count > 0)))