Giter VIP home page Giter VIP logo

Comments (5)

mscdex avatar mscdex commented on June 26, 2024

I tried duplicating this locally (with FileZilla Server) but it works for me.

from node-ftp.

codeanywhere avatar codeanywhere commented on June 26, 2024

I've created you test ftp account so you can test it directly. The server is CentOs with cpanel/whm software, regular web hosting account.

host: 50.28.85.148
user: a1sb
pass: testpass

There are two folders inside public_html: "app" and "app' 2", they have identical content, but first one returns file list and second returns empty list.

from node-ftp.

mscdex avatar mscdex commented on June 26, 2024

Ok, so it looks like the behavior is undefined with paths like this. Implementations seem to differ when it comes to handling paths with spaces, quotes, and the like.

At this point I would probably do something like what the FileZilla client does, which is: change to the directory, do a list, and then change back. Something like this:

function sillylist(path, cb) {
  if (typeof path === 'string') {
    // store current path
    c.pwd(function(err, origpath) {
      if (err) return cb(err);
      // change to destination path
      c.cwd(path, function(err) {
        if (err) return cb(err);
        // get dir listing
        c.list(function(err, list) {
          // change back to original path
          if (err) return c.cwd(origpath, cb);
          c.cwd(origpath, function(err) {
            if (err) return cb(err);
            cb(err, list);
          });
        });
      });
    });
  } else
    c.list(path, cb);
}

I believe that should work for all implementations no matter the characters in the path. I am thinking about possibly adding this as a separate, "safe" version of list() to avoid this kind of thing in the future.

from node-ftp.

codeanywhere avatar codeanywhere commented on June 26, 2024

Using a CWD command works for me. Thank you!

from node-ftp.

alireza79792000 avatar alireza79792000 commented on June 26, 2024

Love

from node-ftp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.