diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-25 09:10:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-25 09:10:18 +0300 |
commit | 4ae91e9f5004d78168b5b50f9ce51db045e479d0 (patch) | |
tree | 5b19e0ee9302696df06bbf980133d44883ba89ba /app/helpers/search_helper.rb | |
parent | c9c77a8466e7cc2b88b6c8ae54365b4123caa2d0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r-- | app/helpers/search_helper.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 377aee1ae9e..d3a34dc38c0 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -250,15 +250,16 @@ module SearchHelper # Sanitize a HTML field for search display. Most tags are stripped out and the # maximum length is set to 200 characters. - def search_md_sanitize(object, field) - html = markdown_field(object, field) - html = Truncato.truncate( - html, + def search_md_sanitize(source) + source = Truncato.truncate( + source, count_tags: false, count_tail: false, max_length: 200 ) + html = markdown(source) + # Truncato's filtered_tags and filtered_attributes are not quite the same sanitize(html, tags: %w(a p ol ul li pre code)) end |