WinSCP zeros files before uploading

Advertisement

njlg
Guest

WinSCP zeros files before uploading

When I drag-n-drop a file from the my local workstation to the server view, to upload a file to the server, and a file by that name already exists on the server, WinSCP zeros the file on the server before presenting the confirmation dialog. The dialog actually says something like this:

. 2011-05-31 09:14:58.955 Asking user:
. 2011-05-31 09:14:58.955 Remote file 'test.txt' already exists. Overwrite?
. 2011-05-31 09:14:58.955
. 2011-05-31 09:14:58.955 New: 76 bytes, 5/31/2011 9:10:13 AM
. 2011-05-31 09:14:58.955 Existing: 0 bytes, 5/31/2011 10:15:01 AM ()

My question is, how do I prevent this behaviour? If I accidentally try to upload the wrong file, by the time I realize and get to cancel the upload, the file has already been cleared.

(I will try to upload a log after I submit this)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: WinSCP zeros files before uploading

WinSCP indeed sends a bit contradictive request to "truncate file if it does not exist" (SSH_FXF_TRUNC + SSH_FXF_EXCL). But anyway, it is valid according to the SFTP spec and the server should fail the request if the file does exist. It indeed failes the request, but maybe it (incorrectly) truncates the file before failing.

You should seek a support on Tectia side.

Anyway, can you send me an email, so I can send you back a debug version of WinSCP if I manage to implement workaround? Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.


> 2011-05-31 09:14:58.194 Type: SSH_FXP_OPEN, Size: 50, Number: 3843
> 2011-05-31 09:14:58.194 03,00,00,0F,03,00,00,00,19,2F,68,6F,6D,65,2F,70,63,33,34,31,33,33,2F,6E,6A,
> 2011-05-31 09:14:58.194 2F,74,65,73,74,2E,74,78,74,00,00,00,3A,00,00,00,01,00,00,00,00,00,00,00,4C,
...
< 2011-05-31 09:14:58.534 Type: SSH_FXP_STATUS, Size: 63, Number: 3843
< 2011-05-31 09:14:58.534 65,00,00,0F,03,00,00,00,04,00,00,00,2C,46,69,6C,65,20,65,78,69,73,74,73,2C,
< 2011-05-31 09:14:58.534 20,66,69,6C,65,3A,20,2F,68,6F,6D,65,2F,70,63,33,34,31,33,33,2F,6E,6A,2F,74,
< 2011-05-31 09:14:58.534 65,73,74,2E,74,78,74,00,00,00,02,65,6E,
< 2011-05-31 09:14:58.534 Status code: 4, Message: 3843, Server: File exists, file: /home/nathan/nj/test.txt, Language: en

Reply with quote

njlg
Joined:
Posts:
1
Location:
Portland, Oregon, USA

Re: WinSCP zeros files before uploading

I sent you an email. Feel free to send me a debugged version of WinSPC if you find a work-around. In the mean time I'll what I can do about the ssh server.

Reply with quote

Advertisement

You can post new topics in this forum