Skip to content
Snippets Groups Projects
Commit 4bd92e68 authored by Robert Speicher's avatar Robert Speicher
Browse files

Return early from markdown and gfm when text is empty

parent e5d89c10
No related branches found
No related tags found
1 merge request!1090Separate rendering of Markdown reference links from redacting those the user doesn't have access to and extracting referenced objects
Loading
Loading
@@ -45,6 +45,8 @@ module GitlabMarkdownHelper
end
 
def markdown(text, context = {})
return unless text.present?
context.merge!(
path: @path,
project: @project,
Loading
Loading
@@ -59,6 +61,8 @@ module GitlabMarkdownHelper
# TODO (rspeicher): Remove all usages of this helper and just call `markdown`
# with a custom pipeline depending on the content being rendered
def gfm(text, options = {})
return unless text.present?
options.merge!(
path: @path,
project: @project,
Loading
Loading
%div{xmlns: "http://www.w3.org/1999/xhtml"}
- if issue.description.present?
= markdown(issue.description, xhtml: true, reference_only_path: false, project: issue.project)
= markdown(issue.description, xhtml: true, reference_only_path: false, project: issue.project)
%div{xmlns: "http://www.w3.org/1999/xhtml"}
- if merge_request.description.present?
= markdown(merge_request.description, xhtml: true, reference_only_path: false, project: merge_request.project)
= markdown(merge_request.description, xhtml: true, reference_only_path: false, project: merge_request.project)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment