cheng-kang / wildfire

🔥From a little spark may burst a flame.
https://wildfire.js.org
GNU General Public License v3.0
178 stars 18 forks source link

pageURL字段值包含中文字段导致wildfire一直处于加载中 #14

Closed lniwn closed 6 years ago

lniwn commented 6 years ago

问题描述 Issue Description

怎么了 What

pageURL字段值包含中文或者其他非标准url字段,会导致wildfire一直处于加载中 _20171227141530 _20171227141457 _20171227141837

如何重现 Reproduce

  1. Hexo的Next主题下,设置pageURL: '{{page.permalink}}'
  2. 文章标题包含中文

其他的话 Other Comment

现在的临时解决方案是,在swig层对url进行编码pageURL: '{{page.permalink|url_encode}}',具体可以参考我的博客。 但还是觉得sdk层应该对这种不可信url进行编码之后再处理比较好。

mrliaocn commented 6 years ago

感谢你的反馈,刚刚也有人反馈过这个问题,我们会立即修正!

mrliaocn commented 6 years ago

这个问题的原因是btoa不支持中文造成的。@lniwn 在bug修复前,你可以将设置修改为:

pageURL:  location.href 
// location.href 会自动将地址中的中文进行编码转换。

来修正这个错误,后面我们在修正时也会兼容这种用法。 预期修正方法见下面一条。

mrliaocn commented 6 years ago

@cheng-kang 可以强制将url进行urlencode, 从而避免中文问题

 btoa(encodeURIComponent(url))
cheng-kang commented 6 years ago

找到了 MDN 对于这个问题的描述以及推荐解决方案。我会采用方案一,然后尽快提交一个新版本。

The issue and solution recommendation.

The "Unicode Problem" - Base64 encoding and decoding - MDN Web Docs

cheng-kang commented 6 years ago

请参考 #16 。

Please refer to #16 .

cheng-kang commented 6 years ago

Duplicate of #16

cheng-kang commented 6 years ago

Fixed in 0d89379