Gitlab目录层级超过6级报500错误不能显示文件列表的问题解决

问题描述

Gitlab目录层级超过6级时,打开报500错误,不能显示文件列表

通过查阅日志:/data/git/gitlab/log/production.log,文件中找到错误记录

  Parameters: {"namespace_id"=>"Android", "project_id"=>"Judicature", "id"=>"master/app/src/main/java/me/yezhou/yzhttp"}
Completed 500 Internal Server Error in 62ms (ActiveRecord: 5.6ms)

ActionView::Template::Error (no implicit conversion of nil into String):
    11:       = @project.path
    12:   - path_breadcrumbs do |title, path|
    13:     %li
    14:       = link_to truncate(title, length: 40), namespace_project_tree_path(@project.namespace, @project, tree_join(@ref, path))
    15:
    16:   - if current_user
    17:     %li
  app/helpers/tree_helper.rb:30:in `join'
  app/helpers/tree_helper.rb:30:in `tree_join'
  app/views/projects/tree/_tree_header.html.haml:14:in `block in _app_views_projects_tree__tree_header_html_haml__809273201855740099_70023699292280'
  app/helpers/tree_helper.rb:84:in `path_breadcrumbs'
  app/views/projects/tree/_tree_header.html.haml:12:in `_app_views_projects_tree__tree_header_html_haml__809273201855740099_70023699292280'
  app/views/projects/_files.html.haml:3:in `_app_views_projects__files_html_haml___3089737261565551882_70023699146800'
  app/views/projects/tree/show.html.haml:10:in `_app_views_projects_tree_show_html_haml___521192939095959849_70023698003460'
  app/controllers/projects/tree_controller.rb:27:in `show'
  app/controllers/application_controller.rb:281:in `set_locale'
  lib/gitlab/middleware/multipart.rb:93:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  lib/gitlab/middleware/go.rb:16:in `call'
  lib/gitlab/etag_caching/middleware.rb:10:in `call'
  lib/gitlab/request_context.rb:18:in `call'

解决方法

参考:

# sudo -u git -H vim app/helpers/tree_helper.rb 
# sudo -u git service gitlab restart

max_links默认值为6,改为更大值

def path_breadcrumbs(max_links = 12)
上一篇 Gitlab图片相对URL
下一篇 Gitlab HTTP 413 curl 22 Request Entity Too Large
目录
文章列表
1 Python格式化日期时间
Python格式化日期时间
2
kubernetes-dashboard卸载及其pod删除
kubernetes-dashboard卸载及其pod删除
3
DialogFragment点击外部区域是否消失
DialogFragment点击外部区域是否消失
4
CentOS下安装Python
CentOS下安装Python
5
fastjson支持配置的PropertyNamingStrategy四种策略
fastjson支持配置的PropertyNamingStrategy四种策略
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。