@@ -6,9 +6,11 @@ module.exports = {
6
6
if ( ! this . fs ) return this . reply ( 550 , 'File system not instantiated' ) ;
7
7
if ( ! this . fs . read ) return this . reply ( 402 , 'Not supported by file system' ) ;
8
8
9
+ const filePath = command . arg ;
10
+
9
11
return this . connector . waitForConnection ( )
10
12
. tap ( ( ) => this . commandSocket . pause ( ) )
11
- . then ( ( ) => Promise . resolve ( this . fs . read ( command . arg , { start : this . restByteCount } ) ) )
13
+ . then ( ( ) => Promise . resolve ( this . fs . read ( filePath , { start : this . restByteCount } ) ) )
12
14
. then ( stream => {
13
15
const destroyConnection = ( connection , reject ) => err => {
14
16
if ( connection ) connection . destroy ( err ) ;
@@ -32,6 +34,7 @@ module.exports = {
32
34
33
35
return this . reply ( 150 ) . then ( ( ) => stream . resume ( ) && this . connector . socket . resume ( ) )
34
36
. then ( ( ) => eventsPromise )
37
+ . tap ( ( ) => this . emit ( 'RETR' , null , filePath ) )
35
38
. finally ( ( ) => stream . destroy && stream . destroy ( ) ) ;
36
39
} )
37
40
. then ( ( ) => this . reply ( 226 ) )
@@ -41,6 +44,7 @@ module.exports = {
41
44
} )
42
45
. catch ( err => {
43
46
log . error ( err ) ;
47
+ this . emit ( 'RETR' , err ) ;
44
48
return this . reply ( 551 , err . message ) ;
45
49
} )
46
50
. finally ( ( ) => {
0 commit comments