File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,7 +89,9 @@ FTP.prototype.connect = function(options) {
8989 this . options . host = options . host || 'localhost' ;
9090 this . options . port = options . port || 21 ;
9191 this . options . user = options . user || 'anonymous' ;
92- this . options . password = options . password || 'anonymous@' ;
92+ this . options . password = options . password ||
93+ options . password === '' ? options . password
94+ : 'anonymous@' ;
9395 this . options . secure = options . secure || false ;
9496 this . options . secureOptions = options . secureOptions ;
9597 this . options . connTimeout = options . connTimeout || 10000 ;
@@ -216,7 +218,8 @@ FTP.prototype.connect = function(options) {
216218 } else if ( cmd === 'USER' ) {
217219 if ( code !== 230 ) {
218220 // password required
219- if ( ! self . options . password ) {
221+ if ( ! self . options . password &&
222+ self . options . password !== '' ) {
220223 self . emit ( 'error' , makeError ( code , 'Password required' ) ) ;
221224 return self . _socket && self . _socket . end ( ) ;
222225 }
You can’t perform that action at this time.
0 commit comments