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

问题描述

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  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'

解决方法

参考:

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

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

1
def path_breadcrumbs(max_links = 12)

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :