Skip to content

Commit

Permalink
fix(deployment): upload artifacts file to alibaba cloud oss mime type…
Browse files Browse the repository at this point in the history
… incorrect (#779)
  • Loading branch information
BlackHole1 committed Jun 30, 2021
1 parent 7e6dab8 commit 910c93f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/deployment/upload-ali-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ const client = new OSS({
os.EOL,
);

const generalAlibabaCloudOSSOptions = {
// ali oss will modify option, cause the upload file type to be incorrect
// so change the variable to a function
// see: https://github.com/ali-sdk/ali-oss/blob/d3583e8460a062a28e12bd719a1929ea659c1c5e/lib/browser/object.js#L69
const generalAlibabaCloudOSSOptions = () => ({
timeout: 1000 * 60 * 2,
};
});

const uploadBackupFile = objectInfo.map(({ backupPath, localPath, size }) => {
const uploadCompleteLog = () => {
Expand All @@ -65,11 +68,11 @@ const client = new OSS({
// use multipart upload when more then 80M
if (size >= 80 * 1000 * 1024) {
return client
.multipartUpload(backupPath, localPath, generalAlibabaCloudOSSOptions)
.multipartUpload(backupPath, localPath, generalAlibabaCloudOSSOptions())
.then(uploadCompleteLog);
} else {
return client
.put(backupPath, localPath, generalAlibabaCloudOSSOptions)
.put(backupPath, localPath, generalAlibabaCloudOSSOptions())
.then(uploadCompleteLog);
}
};
Expand Down

0 comments on commit 910c93f

Please sign in to comment.