-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List command does not work with path containing apostrophe character #55
Comments
I tried duplicating this locally (with FileZilla Server) but it works for me. |
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 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. |
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 |
Using a CWD command works for me. Thank you! |
Love |
List command fails to return file list when there is apostrophe (') char in the path parameter (for example "public_html/test's dir"), although it does not return any error.
The text was updated successfully, but these errors were encountered: