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) {