SFTPClient.DownloadFile Overwriting local file

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
jeisen
Posts: 12
Joined: Sat 14 Feb 2015 20:15

SFTPClient.DownloadFile Overwriting local file

Post by jeisen » Sat 13 Feb 2016 18:16

I'm using Delphi XE8 and SFTPCLient.DownLoad file works perfectly when overwrite is set to true. However, when set to false I get error 80 and the OnError event does not seem to fire. I tried to set a breakpoint in the OnError event but it doesn't work. I also tried using try except on e:EScSFTPError and it doesn't break either. I suspect it triggers the error somewhere in the DownLoad code?

I appreciate any assistance, I want to be able to allow the user to decide whether to overwrite the local file.
thank you

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SFTPClient.DownloadFile Overwriting local file

Post by ViktorV » Mon 15 Feb 2016 10:35

To snip this error, you can use the following code:

Code: Select all

try
  ScSFTPClient.DownloadFile(Path, Filename, False);
except
  on E: EOSError do
    ShowMessage('File already exists.');
end;

jeisen
Posts: 12
Joined: Sat 14 Feb 2015 20:15

Re: SFTPClient.DownloadFile Overwriting local file

Post by jeisen » Tue 16 Feb 2016 16:04

nope ..still does not trap the error

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SFTPClient.DownloadFile Overwriting local file

Post by ViktorV » Wed 17 Feb 2016 14:57

Please check whether the issue is reproduced on our SFTPClient demo project, that can be found in the 'Demos\SFTPClient' folder relatively to the SecureBridge demos installation path. In addition, please clarify - is the TScSFTPClient.NonBlocking proeprty set to True? If it is, then set it to False and check whether the error can be snipped.

jeisen
Posts: 12
Joined: Sat 14 Feb 2015 20:15

Re: SFTPClient.DownloadFile Overwriting local file

Post by jeisen » Mon 22 Feb 2016 23:51

setting the nonblocking property did it..thanks

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: SFTPClient.DownloadFile Overwriting local file

Post by ViktorV » Tue 23 Feb 2016 14:38

It is good to see that the problem has been solved.
If you have any questions during using our products, please don't hesitate to contact us - and we will try to help you solve them.

Post Reply