node-ftp-client icon indicating copy to clipboard operation
node-ftp-client copied to clipboard

download seems to skip first file

Open jasonhillier opened this issue 9 years ago • 5 comments

Hello,

I'm having an issue where if I do a download on a remote directory with only 1 file, it seems to think there are no files in the directory. I'm assuming this is a difference between my FTP server and the one you may have used to test with.

These lines appear to be the culprit:

lib/client.js 279: if (list && list.length > 1) { 280: _.each(list.splice(1, list.length - 1), function (file) {

jasonhillier avatar Sep 12 '15 00:09 jasonhillier

I found the solution .. just replace this lib/client.js 279: if (list && list.length > 1) { 280: _.each(list.splice(1, list.length - 1), function (file) {

with

if (list && list.length > 0) { _.each(list.splice(0, list.length), function (file) {

actually the splice function was used wrongly.

piysingh avatar Feb 18 '16 15:02 piysingh

When i get the next version with fixed above issues.

smjservertest avatar Nov 25 '16 12:11 smjservertest

Fixed on my fork https://github.com/rahman95/node-ftp-client

rahman95 avatar Jan 23 '17 15:01 rahman95

I am had the same issue. So, I changed client.js line 280

 _.each(list.splice(1, list.length-1), function (file) ...

with

 _.each(list.splice(0, list.length), function (file)... 

this fixed my issue.

neelshah23 avatar Jan 25 '17 10:01 neelshah23

Fixed on my fork https://github.com/rahman95/node-ftp-client

Thank you so much

rspacecode avatar Dec 12 '19 07:12 rspacecode