|
|
@@ -196,7 +196,7 @@ export class MinIOXHRMultipartUploader {
|
|
|
key: string,
|
|
|
uploadedParts: UploadPart[]
|
|
|
): Promise<void> {
|
|
|
- const response = await fileClient["complete-multipart-upload"].$post({
|
|
|
+ const response = await fileClient["multipart-complete"].$post({
|
|
|
json:{
|
|
|
bucket: policy.bucket,
|
|
|
key,
|
|
|
@@ -268,9 +268,9 @@ export class MinIOXHRUploader {
|
|
|
}
|
|
|
callbacks?.onComplete?.();
|
|
|
resolve({
|
|
|
- fileUrl:`${policy.host}/${key}`,
|
|
|
+ fileUrl:`${policy.uploadPolicy.host}/${key}`,
|
|
|
fileKey: key,
|
|
|
- bucketName: policy.bucket
|
|
|
+ bucketName: policy.uploadPolicy.bucket
|
|
|
});
|
|
|
} else {
|
|
|
const error = new Error(`上传失败: ${xhr.status} ${xhr.statusText}`);
|
|
|
@@ -296,9 +296,9 @@ export class MinIOXHRUploader {
|
|
|
|
|
|
// 根据当前页面协议和 host 配置决定最终的上传地址
|
|
|
const currentProtocol = typeof window !== 'undefined' ? window.location.protocol : 'https:';
|
|
|
- const host = policy.host?.startsWith('http')
|
|
|
- ? policy.host
|
|
|
- : `${currentProtocol}//${policy.host}`;
|
|
|
+ const host = policy.uploadPolicy.host?.startsWith('http')
|
|
|
+ ? policy.uploadPolicy.host
|
|
|
+ : `${currentProtocol}//${policy.uploadPolicy.host}`;
|
|
|
// 开始上传
|
|
|
xhr.open('POST', host);
|
|
|
xhr.send(formData);
|
|
|
@@ -315,7 +315,7 @@ export class MinIOXHRUploader {
|
|
|
}
|
|
|
|
|
|
export async function getUploadPolicy(key: string): Promise<MinioUploadPolicy> {
|
|
|
- const policyResponse = await fileClient.policy.$post({
|
|
|
+ const policyResponse = await fileClient["upload-policy"].$post({
|
|
|
json: { key }
|
|
|
});
|
|
|
if (!policyResponse.ok) {
|