Skip to content

Commit

Permalink
fix: support aliyun oss (#572)
Browse files Browse the repository at this point in the history
阿里云oss上传必须是 `key` 做为第一个参数,因此调整以下顺序
  • Loading branch information
cipchk authored Jul 12, 2020
1 parent 46b68d8 commit edfd2c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ts/upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,16 @@ const uploadFiles = (vditor: IVditor, files: FileList | DataTransferItemList | F
}

const formData = new FormData();
for (let i = 0, iMax = validateResult.length; i < iMax; i++) {
formData.append(vditor.options.upload.fieldName, validateResult[i]);
}

const extraData = vditor.options.upload.extraData;
for (const key of Object.keys(extraData)) {
formData.append(key, extraData[key]);
}

for (let i = 0, iMax = validateResult.length; i < iMax; i++) {
formData.append(vditor.options.upload.fieldName, validateResult[i]);
}

const xhr = new XMLHttpRequest();
xhr.open("POST", vditor.options.upload.url);
if (vditor.options.upload.token) {
Expand Down

0 comments on commit edfd2c2

Please sign in to comment.