<commit_before>module TextWithLinksHelper

  def text_with_links(text)
    return unless text
    sanitized = sanitize(text, tags: [], attributes: [])
    Rinku.auto_link(sanitized, :all, 'target="_blank" rel="nofollow"').html_safe
  end

  def safe_html_with_links(html)
    return html.html_safe unless html.html_safe?
    Rinku.auto_link(html, :all, 'target="_blank" rel="nofollow"').html_safe
  end

  def simple_format_no_tags_no_sanitize(html)
    simple_format(html, {}, sanitize: false)
  end

end<commit_msg>Prevent empty html to be safe rendered to html with links<commit_after>module TextWithLinksHelper

  def text_with_links(text)
    return unless text
    sanitized = sanitize(text, tags: [], attributes: [])
    Rinku.auto_link(sanitized, :all, 'target="_blank" rel="nofollow"').html_safe
  end

  def safe_html_with_links(html)
    return if html.nil?
    return html.html_safe unless html.html_safe?
    Rinku.auto_link(html, :all, 'target="_blank" rel="nofollow"').html_safe
  end

  def simple_format_no_tags_no_sanitize(html)
    simple_format(html, {}, sanitize: false)
  end

end
{'fraction_non_alphanumeric': 0.11070780399274047, 'fraction_numerical': 0.0, 'mean_word_length': 4.962162162162162, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3815286', 'n_tokens_mistral': 388, 'n_tokens_neox': 383, 'n_words': 80}