Explorar o código

Bug fix: /refresh parameter with sftp:// URL was not working for SFTP sessions with enabled fallback to SCP protocol

Source commit: 23e75740ce77f838bd30064eb456404333a6aa51
Martin Prikryl %!s(int64=7) %!d(string=hai) anos
pai
achega
4f4f446565
Modificáronse 1 ficheiros con 13 adicións e 1 borrados
  1. 13 1
      source/core/SessionData.cpp

+ 13 - 1
source/core/SessionData.cpp

@@ -509,10 +509,22 @@ bool __fastcall TSessionData::IsSame(const TSessionData * Default, bool Advanced
   return IsSame(Default, AdvancedOnly, NULL);
 }
 //---------------------------------------------------------------------
+static TFSProtocol NormalizeFSProtocol(TFSProtocol FSProtocol)
+{
+  if ((FSProtocol == fsSCPonly) || (FSProtocol == fsSFTPonly))
+  {
+    FSProtocol = fsSFTP;
+  }
+  return FSProtocol;
+}
+//---------------------------------------------------------------------
 bool __fastcall TSessionData::IsSameSite(const TSessionData * Other)
 {
   return
-    (FSProtocol == Other->FSProtocol) &&
+    // Particularly when handling /refresh,
+    // fsSFTPonly sites when compared against sftp:// URLs (fsSFTP) have to match.
+    // But similarly also falled back SCP sites.
+    (NormalizeFSProtocol(FSProtocol) == NormalizeFSProtocol(Other->FSProtocol)) &&
     (HostName == Other->HostName) &&
     (PortNumber == Other->PortNumber) &&
     (UserName == Other->UserName);