Commit 8d171a8cbcec2748b583b75b2e304634e0ecd348

Authored by Vanja Radovanović
1 parent 56046130

fixed commit title when commit message is an empty string and ensured that link_…

…to_gfm helper doesn't break on nil body
app/decorators/commit_decorator.rb
... ... @@ -16,7 +16,7 @@ class CommitDecorator < ApplicationDecorator
16 16 # In case this first line is longer than 80 characters, it is cut off
17 17 # after 70 characters and ellipses (`&hellp;`) are appended.
18 18 def title
19   - return no_commit_message unless safe_message
  19 + return no_commit_message unless safe_message && !safe_message.strip.empty?
20 20  
21 21 title_end = safe_message.index(/\n/)
22 22 if (!title_end && safe_message.length > 80) || (title_end && title_end > 80)
... ...
app/helpers/gitlab_markdown_helper.rb
... ... @@ -11,6 +11,8 @@ module GitlabMarkdownHelper
11 11 # explicitly produce the correct linking behavior (i.e.
12 12 # "<a>outer text </a><a>gfm ref</a><a> more outer text</a>").
13 13 def link_to_gfm(body, url, html_options = {})
  14 + return "" unless body && !body.strip.empty?
  15 +
14 16 gfm_body = gfm(body, html_options)
15 17  
16 18 gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match|
... ...