timburgess / brackets-ftp-sync

FTP/SFTP for Adobe Brackets
105 stars 19 forks source link

Escape spaces in file names before calling ls in FTP.exists #64

Open ryanmcfall opened 9 years ago

ryanmcfall commented 9 years ago

This fixes a bug in which filenames containing spaces are uploaded to the server every time that a sync operation is initiated. The bug occurs because, at least on the ftp server that I am using, the ls command invokes the callback with a data argument whose length property is zero, therefore indicating to ftp-sync that the file does not exist on the server.

This should potentially be considered a bug in jsftp rather than ftp-sync, so perhaps it should be reported there instead; I'll leave that decision to you.

timburgess commented 9 years ago

Thanks for this and awesome to see contributions. With changes in core.js, I want to review and test these pretty thoroughly before bringing them into the codebase.

ryanmcfall commented 9 years ago

Tim:

Note that I was unaware that committing to the forked version of the repository after submitting a pull request would result in those changes being part of the pull request (I thought it was static).

So the original pull request is just the commit with SHA 1feb3d024737b4de76be78c5b2d7b73e784fdd67, which only changes FTP.js

The subsequent commits eliminate the checking of file sizes on the server altogether, by recording (in .ftpsync_settings) the local time when a sync was last completed, and then comparing file modification dates to that date in order to determine what needs to be uploaded.

This change seems to be working for me, but more eyes on it and additional testing would certainly be good.

timburgess commented 9 years ago

OK. I have cherry-picked 1feb3d0 into the master branch.