[DRE-maint] Bug#890757: gitlab: Error 500 when issue has code block to render

Libor Klepáč libor.klepac at bcom.cz
Sun Feb 18 13:39:05 UTC 2018


Package: gitlab
Version: 9.5.4+dfsg-5
Severity: normal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello,
when issue has some code block to render, there is error 500 in dashboard

Started GET "/dashboard/activity?limit=20&offset=0" for x.x.x.x at 2018-02-18 07:53:57 +0100
Processing by DashboardController#activity as JSON
  Parameters: {"limit"=>"20", "offset"=>"0"}
Completed 500 Internal Server Error in 586ms (ActiveRecord: 41.3ms)

ActionView::Template::Error (undefined method `html_escape' for #<Banzai::Renderer::HTML:0x0000557b9f3b4ca8>
Did you mean?  html_safe?):
    10: .event-body
    11:   .event-note
    12:     .md
    13:       = event_note(event.target.note, project: event.project)
    14:     - note = event.target
    15:     - if note.attachment.url
    16:       - if note.attachment.image?
  lib/banzai/renderer/html.rb:8:in `block_code'
  lib/banzai/filter/markdown_filter.rb:10:in `render'
  lib/banzai/filter/markdown_filter.rb:10:in `call'
  lib/banzai/pipeline/base_pipeline.rb:21:in `block (2 levels) in singleton class'
  lib/banzai/renderer.rb:107:in `render_result'
  lib/banzai/renderer.rb:138:in `block in cacheless_render'
  lib/gitlab/metrics/influx_db.rb:92:in `measure'
  lib/banzai/renderer.rb:137:in `cacheless_render'
  lib/banzai/renderer.rb:28:in `render'
  lib/banzai.rb:3:in `render'
  app/helpers/markup_helper.rb:220:in `markdown_unsafe'
  app/helpers/markup_helper.rb:79:in `markdown'
  app/helpers/markup_helper.rb:70:in `first_line_in_markdown'
  app/helpers/events_helper.rb:174:in `event_note'
  app/views/events/event/_note.html.haml:13:in `_app_views_events_event__note_html_haml___3195316608961436102_46994720833940'
  app/views/events/_event.html.haml:11:in `_app_views_events__event_html_haml__2698820872038661657_46994679561920'
  app/views/events/_events.html.haml:1:in `_app_views_events__events_html_haml___93854884984734810_46994679725040'
  app/controllers/application_controller.rb:234:in `pager_json'
  app/controllers/dashboard_controller.rb:17:in `block (2 levels) in activity'
  app/controllers/dashboard_controller.rb:12:in `activity'
  lib/gitlab/i18n.rb:46:in `with_locale'
  lib/gitlab/i18n.rb:52:in `with_user_locale'
  app/controllers/application_controller.rb:326: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:17:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'

and isssue detail
Started GET "/group/project/issues/4097" for x.x.x.x at 2018-02-18 07:54:02 +0100
Processing by Projects::IssuesController#show as HTML
  Parameters: {"namespace_id"=>"group", "project_id"=>"project", "id"=>"4097"}
Completed 500 Internal Server Error in 67ms (ActiveRecord: 21.6ms)

NoMethodError (undefined method `html_escape' for #<Banzai::Renderer::HTML:0x0000557b9f3b4ca8>
Did you mean?  html_safe?):
  lib/banzai/renderer/html.rb:8:in `block_code'
  lib/banzai/filter/markdown_filter.rb:10:in `render'
  lib/banzai/filter/markdown_filter.rb:10:in `call'
  lib/banzai/pipeline/base_pipeline.rb:21:in `block (2 levels) in singleton class'
  lib/banzai/renderer.rb:107:in `render_result'
  lib/banzai/renderer.rb:138:in `block in cacheless_render'
  lib/gitlab/metrics/influx_db.rb:92:in `measure'
  lib/banzai/renderer.rb:137:in `cacheless_render'
  lib/banzai/renderer.rb:49:in `cacheless_render_field'
  app/models/concerns/cache_markdown_field.rb:68:in `block in refresh_markdown_cache!'
  app/models/concerns/cache_markdown_field.rb:65:in `map'
  app/models/concerns/cache_markdown_field.rb:65:in `refresh_markdown_cache!'
  lib/banzai/renderer.rb:39:in `render_field'
  lib/banzai.rb:7:in `render_field'
  lib/banzai/object_renderer.rb:51:in `block in render_documents'
  lib/banzai/object_renderer.rb:50:in `map'
  lib/banzai/object_renderer.rb:50:in `render_documents'
  lib/banzai/object_renderer.rb:34:in `render'
  lib/banzai/note_renderer.rb:18:in `render'
  app/controllers/concerns/renders_notes.rb:5:in `prepare_notes_for_rendering'
  app/controllers/projects/issues_controller.rb:89:in `show'
  lib/gitlab/i18n.rb:46:in `with_locale'
  lib/gitlab/i18n.rb:52:in `with_user_locale'
  app/controllers/application_controller.rb:326: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:17:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'

or saving new issue
Started POST "/root/test/issues" for x.x.x.x at 2018-02-18 13:50:08 +0100
Processing by Projects::IssuesController#create as HTML
  Parameters: {"utf8"=>"▒..", "authenticity_token"=>"[FILTERED]", "issue"=>{"title"=>"test", "description"=>"```\r\ntest\r\ntet\r\n```", "confidential"=>"0", "assignee_ids"=>["0"], "label_ids"=>[""], "due_date"=>"", "lock_version"=>""},
"namespace_id"=>"root", "project_id"=>"test"}
Completed 500 Internal Server Error in 40ms (ActiveRecord: 4.3ms)

NoMethodError (undefined method `html_escape' for #<Banzai::Renderer::HTML:0x000055a9f939d6d8>
Did you mean?  html_safe?):
  lib/banzai/renderer/html.rb:8:in `block_code'
  lib/banzai/filter/markdown_filter.rb:10:in `render'
  lib/banzai/filter/markdown_filter.rb:10:in `call'
  lib/banzai/pipeline/base_pipeline.rb:21:in `block (2 levels) in singleton class'
  lib/banzai/renderer.rb:107:in `render_result'
  lib/banzai/renderer.rb:138:in `block in cacheless_render'
  lib/gitlab/metrics/influx_db.rb:92:in `measure'
  lib/banzai/renderer.rb:137:in `cacheless_render'
  lib/banzai/renderer.rb:49:in `cacheless_render_field'
  app/models/concerns/cache_markdown_field.rb:68:in `block in refresh_markdown_cache!'
  app/models/concerns/cache_markdown_field.rb:65:in `map'
  app/models/concerns/cache_markdown_field.rb:65:in `refresh_markdown_cache!'
  app/services/issuable_base_service.rb:161:in `block in create_issuable'
  app/services/issuable_base_service.rb:160:in `create_issuable'
  app/services/issuable_base_service.rb:180:in `create'
  app/services/issues/create_service.rb:12:in `execute'
  app/controllers/projects/issues_controller.rb:106:in `create'
  lib/gitlab/i18n.rb:46:in `with_locale'
  lib/gitlab/i18n.rb:52:in `with_user_locale'
  app/controllers/application_controller.rb:326: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:17:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'


It can be "fixed" by reverting edit of lib/banzai/filter/markdown_filter.rb from
https://gitlab.com/gitlab-org/gitlab-ee/commit/2e8aa209f013d567bb3956a3e4201d3b2d63fe10

but it's just a hack to make it working for us

Libor

-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEPGZVVU37tFmB0TQv8O+MbsKfR44FAlqJgfkVHGxpYm9yLmts
ZXBhY0BiY29tLmN6AAoJEPDvjG7Cn0eO770P/iioawoiVWjdglwJV++7UsVFbYGT
jcNuLelCVECHgHD+HOoewlplPHEjaRCZKBVUo7TjBnfEJcgHlBHFhQUX8krX/TQ1
MUlfhju1EyQH3l0Gdu/ZVF+a+q/wXhhgG8Ht4XJ1ib1r75Mv+ky1buE9rCUA8mfh
sWUupza23IPQfru76LplcJeB8+wSL8yOl/43PueRKOlY5VPVBdaDxGjKtFGshu/P
VYPob2+vp1LOJVaWXeRBpI+cmJYIJBKAe/9K0uWS49VJiJJI6iC679v60OxZ4bSf
U19hXnUb9/N+km20Q7hG/REOVvzWMA0es+/Sf1jkkN1iK4w03bvQGzWySn2R/rZY
20MD2E1rvI+ru+sOUpQ3KTdUMNJ6QxzA4bzeIIctYHlHUvll2HlfKm1Id04T85F+
bR3zLkJW165QSHiTQ/Pslx2lDtYty+o3uEG3c/SevAeKwTtvAC/nnGiqfUrJMC4v
mAYkiC3zxAdhwMeVOBcIfRqGLT4so7bQoRJUc3tEa0ntylNMMVP8jGc0Qtw96UpD
SEKLo3tyI5T4OC/iRszB1nhwZ0FWI+fdcUEBLNqnspJ99jW5HHlXd3f31dbC+Ceo
vv7V2GQSgHI3dsi1Dsat4D80BIazu3g99p3fl9QnXKy4LjGFnfTqLroJQl0XVIDO
Pa25o5+7kO0Enoha
=qnE0
-----END PGP SIGNATURE-----


More information about the Pkg-ruby-extras-maintainers mailing list