codefine / hexo-theme-mellow

based on material design
https://hexo.lujingtao.com
The Unlicense
162 stars 32 forks source link

gitment Error: Validation Failed(中文路径问题导致label过长) #37

Open dandanXO opened 5 years ago

dandanXO commented 5 years ago

發這bug 是因為如果流言issue labels 長度過長 會無法註冊issue

中文字會被url encode(label長度過長) ,目前解決方法是先將中文字urldecode 如果要徹底解決可能還是要換一個issue ID方式

codefine commented 5 years ago

@dandanXO Got it. 近期刚换工作,比较忙,空闲时间我看下。

YuanLiChenAi commented 5 years ago

image https://www.jianshu.com/p/57afa4844aaa

codefine commented 5 years ago

经过长时间调研,发现没有特别完美的解决方案,目前痛点如下:

  1. path可能会重复 -> 文章与issue不能正确匹配
  2. path含有中文会导致label过长 -> 无法创建issue
  3. 有部分用户会在_post下创建二级目录进行分级 -> 移动文章或者更改分级名称时导致文章与issue不能正确匹配

目前可行性方案评估如下:


通过查看hexo官方文档,在文档 - Front-matter中发现了permalink这样的属性,可以覆盖文章地址。于是window.location.pathname就可以捕捉到date+permalink这样格式的值。

permalink: userpath -> window.location.pathname === 2019/02/28/userpath/

所以如果习惯使用中文文件名(不推荐),或者有文章分级存放的用户,请在文件头中加入该属性来避免gitment的问题。

以上。

@YuanLiChenAi @dandanXO

dandanXO commented 5 years ago

了解 @codefine 可以順便把我blog放上去嗎 https://blog.dandan.tw/

codefine commented 5 years ago

@dandanXO ok