diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-02 09:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-02 09:08:59 +0300 |
commit | 5ab92edc77d032261ce105e3fa13355b92f8ed32 (patch) | |
tree | d2628c82859c7c8810481ec54c7d564f2e080b78 /app/services/markup | |
parent | 0409a31740fa29fa1131c0496da16677cb3debe4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/markup')
-rw-r--r-- | app/services/markup/rendering_service.rb | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/app/services/markup/rendering_service.rb b/app/services/markup/rendering_service.rb index c4abbb6b5b0..cd89c170efa 100644 --- a/app/services/markup/rendering_service.rb +++ b/app/services/markup/rendering_service.rb @@ -2,12 +2,6 @@ module Markup class RenderingService - # Let's increase the render timeout - # For a smaller one, a test that renders the blob content statically fails - # We can consider removing this custom timeout when markup_rendering_timeout FF is removed: - # https://gitlab.com/gitlab-org/gitlab/-/issues/365358 - RENDER_TIMEOUT = 5.seconds - def initialize(text, file_name: nil, context: {}, postprocess_context: {}) @text = text @file_name = file_name @@ -19,7 +13,7 @@ module Markup return '' unless text.present? return context.delete(:rendered) if context.has_key?(:rendered) - html = file_name ? markup_unsafe : markdown_unsafe + html = markup_unsafe return '' unless html.present? @@ -29,27 +23,17 @@ module Markup private def markup_unsafe - markup = proc do - if Gitlab::MarkupHelper.gitlab_markdown?(file_name) - markdown_unsafe - elsif Gitlab::MarkupHelper.asciidoc?(file_name) - asciidoc_unsafe - elsif Gitlab::MarkupHelper.plain?(file_name) - plain_unsafe - else - other_markup_unsafe - end - end - - if Feature.enabled?(:markup_rendering_timeout, context[:project]) - Gitlab::RenderTimeout.timeout(foreground: RENDER_TIMEOUT, &markup) + return markdown_unsafe unless file_name + + if Gitlab::MarkupHelper.gitlab_markdown?(file_name) + markdown_unsafe + elsif Gitlab::MarkupHelper.asciidoc?(file_name) + asciidoc_unsafe + elsif Gitlab::MarkupHelper.plain?(file_name) + plain_unsafe else - markup.call + other_markup_unsafe end - rescue StandardError => e - Gitlab::ErrorTracking.track_exception(e, project_id: context[:project]&.id, file_name: file_name) - - ActionController::Base.helpers.simple_format(text) end def markdown_unsafe |