@@ -46,7 +46,7 @@ export async function exist(s3, bucket, fileInformation, progressFn, changeStatu
|
||||
if (fileInformation.sharding.length === 0) {
|
||||
let existBucket = await existInBucket({ s3, bucket, fileInformation: fileInformation });
|
||||
if (existBucket === 'true') {
|
||||
progressFn(0, fileInformation.file, 1);
|
||||
progressFn(1, fileInformation.file, 0);
|
||||
changeStatus(fileInformation.path, 'success');//直接告诉前端,状态
|
||||
return;
|
||||
} else if (existBucket === 'same key') {
|
||||
|
||||
+6
-3
@@ -188,11 +188,14 @@ function uploadAWS(aws, data, progress) {
|
||||
objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1]
|
||||
data.path = objectItem.join('/')
|
||||
}
|
||||
await exist(aws, Vue.prototype.OSSclientConfig.bucket, data, progress, (path, status) => {
|
||||
let bucketName = data.path.split("/")[1] || Vue.prototype.OSSclientConfig.bucket
|
||||
let curPath = data.path;
|
||||
data.path = data.path.replace(`/${bucketName}/`, '');
|
||||
await exist(aws, bucketName, data, progress, (path, status) => {
|
||||
if (status === 'success') {
|
||||
resolve({
|
||||
name: Vue.prototype.OSSclientConfig.bucket + "/" + decodeUtf8(path),
|
||||
url: Vue.prototype.OSSclientConfig.viewEndpoint + Vue.prototype.OSSclientConfig.bucket + "/" + decodeUtf8(path)
|
||||
name: decodeUtf8(curPath),
|
||||
url: Vue.prototype.OSSclientConfig.viewEndpoint + decodeUtf8(curPath)
|
||||
})
|
||||
} else {
|
||||
reject()
|
||||
|
||||
Reference in New Issue
Block a user