Skip to content

Commit 0d57521

Browse files
committed
fix the bug that Object.assign could modify the object insensibility
1 parent c212935 commit 0d57521

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

app/components/services/domains.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ angular.module("web").factory("Domains", [
3838

3939
signatureUrl(key, expires, opt) {
4040
expires = expires || this.maxLifetime();
41-
const newOpt = Object.assign(opt || {}, { preferS3Adapter: true });
41+
const newOpt = Object.assign({}, opt, { preferS3Adapter: true });
4242
return QiniuClient.signatureUrl(this.region, this.bucket, key, undefined, expires, newOpt);
4343
}
4444

4545
getContent(key, opt) {
46-
const newOpt = Object.assign(opt || {}, { preferS3Adapter: true });
46+
const newOpt = Object.assign({}, opt, { preferS3Adapter: true });
4747
return QiniuClient.getContent(this.region, this.bucket, key, this.toQiniuDomain(), newOpt);
4848
}
4949

5050
saveContent(key, content, opt) {
51-
const newOpt = Object.assign(opt || {}, { preferS3Adapter: true });
51+
const newOpt = Object.assign({}, opt, { preferS3Adapter: true });
5252
return QiniuClient.saveContent(this.region, this.bucket, key, content, this.toQiniuDomain(), newOpt);
5353
}
5454

@@ -86,17 +86,17 @@ angular.module("web").factory("Domains", [
8686

8787
signatureUrl(key, expires, opt) {
8888
expires = expires || this.maxLifetime();
89-
const newOpt = Object.assign(opt || {}, { preferKodoAdapter: true });
89+
const newOpt = Object.assign({}, opt, { preferKodoAdapter: true });
9090
return QiniuClient.signatureUrl(this.region, this.bucket, key, this.domain, expires, newOpt);
9191
}
9292

9393
getContent(key, opt) {
94-
const newOpt = Object.assign(opt || {}, { preferKodoAdapter: true });
94+
const newOpt = Object.assign({}, opt, { preferKodoAdapter: true });
9595
return QiniuClient.getContent(this.region, this.bucket, key, this.toQiniuDomain(), newOpt);
9696
}
9797

9898
saveContent(key, content, opt) {
99-
const newOpt = Object.assign(opt || {}, { preferKodoAdapter: true });
99+
const newOpt = Object.assign({}, opt, { preferKodoAdapter: true });
100100
return QiniuClient.saveContent(this.region, this.bucket, key, content, this.toQiniuDomain(), newOpt);
101101
}
102102

node/qiniu-store/lib/download-job.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ DownloadJob.prototype.start = function (params) {
8787
let job = {
8888
job: this.id,
8989
key: 'job-download',
90-
clientOptions: Object.assign(this.clientOptions, { backendMode: this.backendMode }),
90+
clientOptions: Object.assign({}, this.clientOptions, { backendMode: this.backendMode }),
9191
options: {
9292
resumeDownload: this.resumeDownload,
9393
maxConcurrency: this.maxConcurrency,

node/qiniu-store/lib/upload-job.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ UploadJob.prototype.start = function (overwrite, prog) {
9393
let job = {
9494
job: this.id,
9595
key: 'job-upload',
96-
clientOptions: Object.assign(this.clientOptions, { backendMode: this.backendMode, isDebug: this.isDebug }),
96+
clientOptions: Object.assign({}, this.clientOptions, { backendMode: this.backendMode, isDebug: this.isDebug }),
9797
options: {
9898
resumeUpload: this.resumeUpload,
9999
maxConcurrency: this.maxConcurrency,

0 commit comments

Comments
 (0)