Browse Source

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

Source commit: 23e75740ce77f838bd30064eb456404333a6aa51
Martin Prikryl 7 years ago
parent
commit
4f4f446565
1 changed files with 13 additions and 1 deletions
  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);