From 3253a96c76cbce02982c86599cd925b50b8cd13a Mon Sep 17 00:00:00 2001 From: life Date: Tue, 27 Oct 2015 10:51:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=9B=BE=E7=89=87=E8=BF=94?= =?UTF-8?q?=E5=9B=9E403?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/leanote/desktop-app/issues/69 --- node_modules/file.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/node_modules/file.js b/node_modules/file.js index 87ef73ba..283fa9b0 100644 --- a/node_modules/file.js +++ b/node_modules/file.js @@ -683,8 +683,9 @@ var File = { date: 'Mon, 19 Jan 2015 15:01:47 GMT', */ // log(resp.headers); - if(err || !resp || resp.statusCode == 404) { + if(err || !resp || resp.statusCode != 200) { callback(false); + return; } else { // 当图片没有时候还是执行这一步 @@ -697,6 +698,12 @@ var File = { } } + // 返回的是字符串, 肯定是403之类的 + if (typeof resp.body === 'string') { + callback(false); + return; + } + var filename = Common.uuid() + '.' + type; var imagePath = User.getCurUserImagesPath(); var imagePathAll = imagePath + '/' + filename; @@ -715,7 +722,10 @@ var File = { // 复制外站图片 copyOtherSiteImage: function(src, callback) { var me = this; + console.log('copyOtherSiteImage'); + console.log(src); me.downloadImg(src, function (filePath) { + console.log(filePath); if (filePath) { me._addImage(Common.objectId(), filePath, function(file) { if (file) {