Comparing version 0.2.2 to 0.2.5
@@ -141,6 +141,9 @@ /* | ||
ftp.raw.cwd("/unexistentDir/", function(err, res) { | ||
assert.ok(err); | ||
if (err) | ||
assert.ok(err); | ||
else { | ||
code = parseInt(res.code, 10); | ||
assert.ok(code === 550, "A (wrong) CWD command was successful. It should have failed"); | ||
} | ||
code = parseInt(res.code, 10); | ||
assert.ok(code === 550, "A (wrong) CWD command was successful. It should have failed"); | ||
next(); | ||
@@ -147,0 +150,0 @@ }); |
21
jsftp.js
@@ -104,3 +104,6 @@ /* | ||
self.keepAlive(); | ||
if (lcCmd === "quit" && self._keepAliveInterval) | ||
clearInterval(self._keepAliveInterval); | ||
else | ||
self.keepAlive(); | ||
@@ -342,2 +345,3 @@ // Check whether the FTP user is authenticated at the moment of the | ||
var callback = command[1]; | ||
var err; | ||
@@ -348,4 +352,9 @@ if (callback) { | ||
// overgeneralize and consider every value above 399 as an error. | ||
var hasFailed = ftpResponse && ftpResponse.code > 399; | ||
callback(hasFailed && (ftpResponse.text || "Unknown FTP error."), ftpResponse); | ||
if (ftpResponse && ftpResponse.code > 399) { | ||
err = new Error(ftpResponse.text || "Unknown FTP error.") | ||
err.code = ftpResponse.code; | ||
callback(err); | ||
} else { | ||
callback(null, ftpResponse); | ||
} | ||
} | ||
@@ -455,7 +464,7 @@ this.nextCmd(); | ||
self.raw.user(user, function(err, res) { | ||
if ([230, 331, 332].indexOf(res.code) > -1) { | ||
if (!err && [230, 331, 332].indexOf(res.code) > -1) { | ||
self.raw.pass(pass, function(err, res) { | ||
self.authenticating = false; | ||
if ([230, 202].indexOf(res.code) > -1) { | ||
if (!err && [230, 202].indexOf(res.code) > -1) { | ||
self.authenticated = true; | ||
@@ -471,3 +480,3 @@ self.user = user; | ||
} | ||
else if (res.code === 332) { | ||
else if (!err && res.code === 332) { | ||
self.raw.acct(""); // ACCT not really supported | ||
@@ -474,0 +483,0 @@ } |
@@ -46,3 +46,3 @@ /** | ||
// or time (for numeric or recent standard format) | ||
+ "(\\d+(?::\\d+)?)\\s+" | ||
+ "(\\d+(?::\\d+)?)\\s*" | ||
@@ -60,3 +60,3 @@ //+ "(\\S*)(\\s*.*)" | ||
+ "(<DIR>)?\\s*" | ||
+ "([0-9]+)?\\s+" | ||
+ "([0-9]+)?\\s*" | ||
+ "(\\S.*)" | ||
@@ -63,0 +63,0 @@ ); |
{ | ||
"name": "jsftp", | ||
"id": "jsftp", | ||
"version": "0.2.2", | ||
"version": "0.2.5", | ||
"description": "A sane FTP client implementation for NodeJS", | ||
@@ -6,0 +6,0 @@ "keywords": [ "ftp", "streams", "files", "server", "client", "async" ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
248086
1696
6