下载图片返回403

https://github.com/leanote/desktop-app/issues/69
This commit is contained in:
life
2015-10-27 10:51:39 +08:00
parent da48d018eb
commit 3253a96c76

12
node_modules/file.js generated vendored
View File

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