Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTP: FtpSession Download function misuses async method call #282

Open
WMG-VincentW opened this issue Aug 17, 2022 · 0 comments
Open

FTP: FtpSession Download function misuses async method call #282

WMG-VincentW opened this issue Aug 17, 2022 · 0 comments

Comments

@WMG-VincentW
Copy link

The implementation of the Download method of the IFtpSession interface for the standard FtpSession class will not work consistently, because of the misuse of an async call. See the below link, but put simply, the wrapped FTP client has two methods, one synchronous, which is used correctly in the case that the Download method is processing a folder, but in the case of files, the wrapped FTP client's asynchronous method is used, which returns and then does nothing with a Task. This renders this function useless if called on anything other than a directory.

Changing the call on line 443 of FtpSession.cs from:
_ftpClient.DownloadFileAsync(localPath, remotePath, overwrite ? FtpLocalExists.Overwrite : FtpLocalExists.Skip); to _ftpClient.DownloadFile(localPath, remotePath, overwrite ? FtpLocalExists.Overwrite : FtpLocalExists.Skip); should resolve the issue.

_ftpClient.DownloadFileAsync(localPath, remotePath, overwrite ? FtpLocalExists.Overwrite : FtpLocalExists.Skip);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant