Skip to content

Commit

Permalink
Catch CWD in Execute to invalidate cwd cache
Browse files Browse the repository at this point in the history
  • Loading branch information
FanDjango committed Nov 3, 2021
1 parent 860af73 commit 6e9b4f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions FluentFTP/Client/FtpClient_FolderManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ public void SetWorkingDirectory(string path) {
}

// invalidate the cached path
_LastWorkingDir = null;
// This is redundant, Execute(...) will see the CWD and do this
//_LastWorkingDir = null;

#if !CORE14
}
Expand Down Expand Up @@ -680,7 +681,8 @@ public void SetWorkingDirectory(string path) {
}

// invalidate the cached path
_LastWorkingDir = null;
// This is redundant, Execute(...) will see the CWD and do this
//_LastWorkingDir = null;
}


Expand Down
5 changes: 5 additions & 0 deletions FluentFTP/Client/FtpClient_Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public FtpReply Execute(string command) {
commandTxt = "PASS ***";
}

// A CWD will invalidate the cached value.
if (command.StartsWith("CWD ", StringComparison.Ordinal)) {
_LastWorkingDir = null;
}

LogLine(FtpTraceLevel.Info, "Command: " + commandTxt);

// send command to FTP server
Expand Down

0 comments on commit 6e9b4f6

Please sign in to comment.