上传文件校验代码细节调整
This commit is contained in:
parent
a9cef770f7
commit
febc30009b
@ -169,11 +169,12 @@ function uploadObject(filesList, index) {
|
|||||||
body: fs.createReadStream(path.resolve(rootPath, filesList[index].name)), // 支持 Buffer/Readable/string
|
body: fs.createReadStream(path.resolve(rootPath, filesList[index].name)), // 支持 Buffer/Readable/string
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
// eTag是上传后远端校验的md5值, 用于和本地进行比对
|
// eTag是上传后远端校验的md5值, 用于和本地进行比对
|
||||||
if(filesList[index].md5 === result.eTag) {
|
let eTag = result.eTag.replace(/"/g,'')
|
||||||
console.log(`${filesList[index].name} 上传成功, md5:${result.eTag} 类型: ${item.type}`)
|
if(filesList[index].md5 === eTag) {
|
||||||
|
console.log(`${filesList[index].name} 上传成功, md5:${eTag} 类型: ${filesList[index].type}`)
|
||||||
} else {
|
} else {
|
||||||
console.warn(`${filesList[index].name} 上传出错, md5值不一致`)
|
console.warn(`${filesList[index].name} 上传出错, md5值不一致`)
|
||||||
console.warn(`===> 本地文件: ${item.md5}, 接口返回: ${result.eTag}`)
|
console.warn(`===> 本地文件: ${filesList[index].md5}, 接口返回: ${eTag}`)
|
||||||
}
|
}
|
||||||
uploadObject.call(this, filesList, ++index)
|
uploadObject.call(this, filesList, ++index)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user