修正typo对中文标题文章支持的bug

Posted by jhsea3do Sun, 20 Dec 2009 16:17:00 GMT

刚装好typo5.4, 发现如果发表的文章采用了中文标题,则对应的permalink将只能返回404页面。

原因在于RedirectController将已经URI.decode过的参数传给了Article.find_by_permalink方法,该方法直接去查询articles表中:permalink列,所以失败。

修改方法很简单,只要修改${TYPO_ROOT}/app/models/article.rb文件第277行,将

req_params[:permalink] = params[:title]

修改为

req_params[:permalink] = URI.encode(params[:title])

即可