马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
gitlab-jh 17.8.3 是从早期jh版本一路升级上来的
现象
访问 左下角 帮助>你的极狐可用版本(https://devops.lygend.com:18088/help/update/index.md)总会有 500错误
根据反馈的 resquestid 去 /var/log/gitlab/gitlab-rails/production_json.log 里查找。得到错误
"exception.class":"NoMethodError","exception.message":"undefined method ends_with?' for #<Pathname:/opt/gitlab/embedded/service/gitlab-rails/jh/doc/update/index.md>","exception.backtrace":["app/controllers/help_controller.rb:147:in markdown_for'","app/controllers/help_controller.rb:130:in `render_documentation'
`app/controllers/help_controller.rb 147 ` 行是这样的
elsif raw_path.ends_with?('index.md')
148 munged_path = raw_path.gsub('index.md', '_index.md')
AI 的反馈是 raw_path 是 Pathname 类型(Ruby 标准库中表示文件路径的对象),而不是 string 类型,不能直接使用 ends_with 和 gsub 方法,改为
elsif raw_path.to_s.ends_with?('index.md')
148 munged_path = raw_path.to_s.gsub('index.md', '_index.md')
就好了。实际上改完然后 reconfigure restart 后,的确也就没错了。
但升级后这个问题就又出现了
能一劳永逸解决么 |