安装typo后,发现用中文标题发表文章,前台对应标题点开则将只能返回404页面,网上找到的方法:
原因在于RedirectController将已经URI.decode过的参数传给了Article.find_by_permalink方 法,该方法直接去查询articles表中:permalink列,所以失败。
修改方法很简单,只要修改${TYPO_ROOT}/app/models/article.rb文件,将
req_params[:permalink] = params[:title]
修改为
req_params[:permalink] = URI.encode(params[:title])
保存刷新,OK!