Commit 5cfde18d01fb46aa14a7e51c69368047c6300b0e

Authored by yvan.ni
1 parent 17d2216c

img src 为空的优化

Showing 1 changed file with 2 additions and 0 deletions
utils/wxParse/html2json.js
@@ -54,6 +54,8 @@ module.exports = { @@ -54,6 +54,8 @@ module.exports = {
54 e; 54 e;
55 }, {})), "img" === s.tag) { 55 }, {})), "img" === s.tag) {
56 s.imgIndex = i.images.length; 56 s.imgIndex = i.images.length;
  57 + if(!s.attr) return false;
  58 + if(!s.attr.src) return false;
57 var d = s.attr.src; 59 var d = s.attr.src;
58 "" == d[0] && d.splice(0, 1), d = l.urlToHttpUrl(d, n), s.attr.src = d, s.from = a, 60 "" == d[0] && d.splice(0, 1), d = l.urlToHttpUrl(d, n), s.attr.src = d, s.from = a,
59 i.images.push(s), i.imageUrls.push(d); 61 i.images.push(s), i.imageUrls.push(d);