Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

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