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)

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/02/25/solution-to-problem-of-gitlab-directory-level-exceeding-6-and-reporting-500-errors-unable-to-display-file-list/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
Gitlab目录层级超过6级报500错误不能显示文件列表的问题解决
问题描述 Gitlab目录层级超过6级时,打开报500错误,不能显示文件列表 通过查阅日志:/data/git/gitlab/log/production.log,文件中找到错误记录 Parameter……
<<上一篇
下一篇>>
文章目录
关闭
目 录