@@ -460,7 +460,7 @@ Client.prototype.downloadFile = function(params) {
460460 if ( statusCode >= 300 ) {
461461 handleError ( new Error ( "http status code " + statusCode ) ) ;
462462 return ;
463- }
463+ }
464464 if ( headers [ 'content-length' ] == undefined ) {
465465 var outStream = fs . createWriteStream ( localFile ) ;
466466 outStream . on ( 'error' , handleError ) ;
@@ -470,14 +470,14 @@ Client.prototype.downloadFile = function(params) {
470470 downloader . progressTotal += chunk . length ;
471471 downloader . progressAmount += chunk . length ;
472472 downloader . emit ( 'progress' ) ;
473- outStream . write ( chunk ) ;
473+ outStream . write ( chunk ) ;
474474 } )
475475
476- request . on ( 'httpDone' , function ( ) {
476+ request . on ( 'httpDone' , function ( ) {
477477 if ( errorOccurred ) return ;
478478 downloader . progressAmount += 1 ;
479479 downloader . emit ( 'progress' ) ;
480- outStream . end ( ) ;
480+ outStream . end ( ) ;
481481 cb ( ) ;
482482 } )
483483 } else {
@@ -1169,7 +1169,11 @@ function syncDir(self, params, directionIsToS3) {
11691169 function startUpload ( ) {
11701170 ee . progressTotal += localFileStat . size ;
11711171 var fullKey = prefix + localFileStat . s3Path ;
1172- upDownFileParams . s3Params . Key = fullKey ;
1172+ if ( ! upDownFileParams . s3Params . Key ) {
1173+ upDownFileParams . s3Params . Key = fullKey ;
1174+ } else {
1175+ fullKey = upDownFileParams . s3Params . Key ;
1176+ }
11731177 upDownFileParams . localFile = fullPath ;
11741178 var uploader = self . uploadFile ( upDownFileParams ) ;
11751179 var prevAmountDone = 0 ;
0 commit comments