@@ -460,7 +460,7 @@ Client.prototype.downloadFile = function(params) {
460
460
if ( statusCode >= 300 ) {
461
461
handleError ( new Error ( "http status code " + statusCode ) ) ;
462
462
return ;
463
- }
463
+ }
464
464
if ( headers [ 'content-length' ] == undefined ) {
465
465
var outStream = fs . createWriteStream ( localFile ) ;
466
466
outStream . on ( 'error' , handleError ) ;
@@ -470,14 +470,14 @@ Client.prototype.downloadFile = function(params) {
470
470
downloader . progressTotal += chunk . length ;
471
471
downloader . progressAmount += chunk . length ;
472
472
downloader . emit ( 'progress' ) ;
473
- outStream . write ( chunk ) ;
473
+ outStream . write ( chunk ) ;
474
474
} )
475
475
476
- request . on ( 'httpDone' , function ( ) {
476
+ request . on ( 'httpDone' , function ( ) {
477
477
if ( errorOccurred ) return ;
478
478
downloader . progressAmount += 1 ;
479
479
downloader . emit ( 'progress' ) ;
480
- outStream . end ( ) ;
480
+ outStream . end ( ) ;
481
481
cb ( ) ;
482
482
} )
483
483
} else {
@@ -1169,7 +1169,9 @@ function syncDir(self, params, directionIsToS3) {
1169
1169
function startUpload ( ) {
1170
1170
ee . progressTotal += localFileStat . size ;
1171
1171
var fullKey = prefix + localFileStat . s3Path ;
1172
- upDownFileParams . s3Params . Key = fullKey ;
1172
+ if ( ! upDownFileParams . s3Params . Key ) {
1173
+ upDownFileParams . s3Params . Key = fullKey ;
1174
+ }
1173
1175
upDownFileParams . localFile = fullPath ;
1174
1176
var uploader = self . uploadFile ( upDownFileParams ) ;
1175
1177
var prevAmountDone = 0 ;
0 commit comments