FIX: FTP - opens incorrect path when quick connection used (issue #1654)

(cherry picked from commit 28152ec7f9)
This commit is contained in:
Alexander Koblov 2024-05-20 21:40:05 +03:00
commit 3e89b9cb95

View file

@ -420,10 +420,9 @@ begin
end;
end;
function QuickConnection: Boolean;
function QuickConnection(out FtpSend: TFTPSendEx): Boolean;
var
Index: Integer;
FtpSend: TFTPSendEx;
Connection: TConnection;
begin
Result:= ActiveConnectionList.IndexOf(cQuickConnection) >= 0;
@ -728,13 +727,9 @@ begin
begin
if not FtpConnect(asFileName, FtpSend) then
Result := FS_EXEC_OK
else
begin
wsFileName := FtpSend.ServerToClient(FtpSend.GetCurrentDir);
wsFileName := SetDirSeparators(RemoteName + wsFileName);
StrPLCopy(RemoteName, wsFileName, MAX_PATH);
Result := FS_EXEC_SYMLINK;
end;
else begin
Result := FS_EXEC_SYMLINK;
end;
end
else // special item
begin
@ -745,12 +740,19 @@ begin
end
else if asFileName = cQuickConnection then
begin
if QuickConnection then
Result := FS_EXEC_SYMLINK
else
Result := FS_EXEC_OK;
if not QuickConnection(FtpSend) then
Result := FS_EXEC_OK
else begin
Result := FS_EXEC_SYMLINK;
end;
end;
end;
if (Result = FS_EXEC_SYMLINK) then
begin
wsFileName := FtpSend.ServerToClient(FtpSend.GetCurrentDir);
wsFileName := SetDirSeparators(RemoteName + wsFileName);
StrPLCopy(RemoteName, wsFileName, MAX_PATH);
end;
end; // root path
end // Verb = open
else if Pos('chmod', UnicodeString(Verb)) = 1 then