From febc30009be91482759301e1ccd862d4981cc56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=93=E5=8F=91=E5=8F=97=E9=95=BF=E7=94=9F?= Date: Fri, 19 Apr 2019 22:56:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E4=BB=A3=E7=A0=81=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/_posts/linux/博客图片迁移记.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/_posts/linux/博客图片迁移记.md b/source/_posts/linux/博客图片迁移记.md index 2b6b656..e7572a8 100644 --- a/source/_posts/linux/博客图片迁移记.md +++ b/source/_posts/linux/博客图片迁移记.md @@ -169,11 +169,12 @@ function uploadObject(filesList, index) { body: fs.createReadStream(path.resolve(rootPath, filesList[index].name)), // 支持 Buffer/Readable/string }).then(result => { // eTag是上传后远端校验的md5值, 用于和本地进行比对 - if(filesList[index].md5 === result.eTag) { - console.log(`${filesList[index].name} 上传成功, md5:${result.eTag} 类型: ${item.type}`) + let eTag = result.eTag.replace(/"/g,'') + if(filesList[index].md5 === eTag) { + console.log(`${filesList[index].name} 上传成功, md5:${eTag} 类型: ${filesList[index].type}`) } else { console.warn(`${filesList[index].name} 上传出错, md5值不一致`) - console.warn(`===> 本地文件: ${item.md5}, 接口返回: ${result.eTag}`) + console.warn(`===> 本地文件: ${filesList[index].md5}, 接口返回: ${eTag}`) } uploadObject.call(this, filesList, ++index) })