@@ -73,7 +73,7 @@ function upload(filePath, bucket, dstpath, bizattr, callback) {
73
73
var isExists = fs . existsSync ( filePath ) ;
74
74
if ( isExists && typeof callback === 'function' ) {
75
75
bucket = bucket . strip ( ) ;
76
- dstpath = encodeURIComponent ( dstpath . strip ( ) ) . replace ( ' %2F' , '/' ) ;
76
+ dstpath = encodeURIComponent ( dstpath . strip ( ) ) . replace ( / % 2 F / g , '/' ) ;
77
77
var expired = parseInt ( Date . now ( ) / 1000 ) + conf . EXPIRED_SECONDS ;
78
78
var sign = auth . signMore ( bucket , expired ) ;
79
79
var url = generateResUrl ( bucket , dstpath ) ;
@@ -133,7 +133,7 @@ function upload(filePath, bucket, dstpath, bizattr, callback) {
133
133
function upload_slice ( filePath , bucket , dstpath , bizattr , slice_size , session , callback ) {
134
134
135
135
bucket = bucket . strip ( ) ;
136
- dstpath = encodeURIComponent ( dstpath . strip ( ) ) . replace ( ' %2F' , '/' ) ;
136
+ dstpath = encodeURIComponent ( dstpath . strip ( ) ) . replace ( / % 2 F / g , '/' ) ;
137
137
if ( typeof bizattr === 'function' ) {
138
138
callback = bizattr ;
139
139
bizattr = null ;
@@ -284,7 +284,7 @@ function upload_data(bucket, dstpath, filePath, offset, length, session, callbac
284
284
*/
285
285
function statFile ( bucket , path , callback ) {
286
286
bucket = bucket . strip ( ) ;
287
- path = encodeURIComponent ( path . strip ( ) ) . replace ( ' %2F' , '/' ) ;
287
+ path = encodeURIComponent ( path . strip ( ) ) . replace ( / % 2 F / g , '/' ) ;
288
288
stat ( bucket , path , callback ) ;
289
289
}
290
290
/**
@@ -296,7 +296,7 @@ function statFile(bucket, path, callback) {
296
296
*/
297
297
function statFolder ( bucket , path , callback ) {
298
298
bucket = bucket . strip ( ) ;
299
- path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( ' %2F' , '/' ) ;
299
+ path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( / % 2 F / g , '/' ) ;
300
300
stat ( bucket , path , callback ) ;
301
301
}
302
302
/**
@@ -346,7 +346,7 @@ function stat(bucket, path, callback) {
346
346
*/
347
347
function deleteFile ( bucket , path , callback ) {
348
348
bucket = bucket . strip ( ) ;
349
- path = encodeURIComponent ( path . strip ( ) ) . replace ( ' %2F' , '/' ) ;
349
+ path = encodeURIComponent ( path . strip ( ) ) . replace ( / % 2 F / g , '/' ) ;
350
350
del ( bucket , path , callback ) ;
351
351
}
352
352
/**
@@ -358,7 +358,7 @@ function deleteFile(bucket, path, callback) {
358
358
*/
359
359
function deleteFolder ( bucket , path , callback ) {
360
360
bucket = bucket . strip ( ) ;
361
- path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( ' %2F' , '/' ) ;
361
+ path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( / % 2 F / g , '/' ) ;
362
362
del ( bucket , path , callback ) ;
363
363
}
364
364
/**
@@ -414,7 +414,7 @@ function del(bucket, path, callback) {
414
414
*/
415
415
function updateFile ( bucket , path , bizattr , callback ) {
416
416
bucket = bucket . strip ( ) ;
417
- path = encodeURIComponent ( path . strip ( ) ) . replace ( ' %2F' , '/' ) ;
417
+ path = encodeURIComponent ( path . strip ( ) ) . replace ( / % 2 F / g , '/' ) ;
418
418
update ( bucket , path , bizattr , callback ) ;
419
419
}
420
420
/**
@@ -426,7 +426,7 @@ function updateFile(bucket, path, bizattr, callback) {
426
426
*/
427
427
function updateFolder ( bucket , path , bizattr , callback ) {
428
428
bucket = bucket . strip ( ) ;
429
- path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( ' %2F' , '/' ) ;
429
+ path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( / % 2 F / g , '/' ) ;
430
430
update ( bucket , path , bizattr , callback ) ;
431
431
}
432
432
/**
@@ -488,7 +488,7 @@ function update(bucket, path, bizattr, callback) {
488
488
*/
489
489
function list ( bucket , path , num , pattern , order , context , callback ) {
490
490
bucket = bucket . strip ( ) ;
491
- path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( ' %2F' , '/' ) ;
491
+ path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( / % 2 F / g , '/' ) ;
492
492
listFiles ( bucket , path , num , pattern , order , context , callback ) ;
493
493
}
494
494
/**
@@ -507,7 +507,7 @@ function list(bucket, path, num, pattern, order, context, callback) {
507
507
*/
508
508
function prefixSearch ( bucket , path , prefix , num , pattern , order , context , callback ) {
509
509
bucket = bucket . strip ( ) ;
510
- path = encodeURIComponent ( path . strip ( ) ) . replace ( ' %2F' , '/' ) ;
510
+ path = encodeURIComponent ( path . strip ( ) ) . replace ( / % 2 F / g , '/' ) ;
511
511
if ( path == '' ) {
512
512
path = prefix ;
513
513
} else {
@@ -597,7 +597,7 @@ function createFolder(bucket, path, bizattr, callback) {
597
597
598
598
if ( typeof callback === 'function' ) {
599
599
bucket = bucket . strip ( ) ;
600
- path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( ' %2F' , '/' ) ;
600
+ path = encodeURIComponent ( path . strip ( ) + '/' ) . replace ( / % 2 F / g , '/' ) ;
601
601
var expired = parseInt ( Date . now ( ) / 1000 ) + conf . EXPIRED_SECONDS ;
602
602
var sign = auth . signMore ( bucket , expired ) ;
603
603
var url = generateResUrl ( bucket , path ) ;
0 commit comments