diff options
author | Luke Duncalfe <lduncalfe@eml.cc> | 2019-10-03 07:01:57 +0300 |
---|---|---|
committer | Luke Duncalfe <lduncalfe@eml.cc> | 2019-10-23 01:40:50 +0300 |
commit | bc534868ec856410ca2664cd7fc9c7f89a48a277 (patch) | |
tree | c6e307f5f6208f3558f86f4a7d2bb2a8c2ab928f /app | |
parent | 1425a56c75beecaa289ad59587d636f8f469509e (diff) |
Pass all wiki markup formats through pipelines
Previously, when the wiki page format was anything other than `markdown`
or `asciidoc` the formatted content would be returned though a Gitaly
call. Gitaly in turn would delegate formatting to the gitlab-gollum-lib
gem, which in turn would delegate that to various gems (like RDoc for
`rdoc`) and then apply some very liberal sanitization.
It was too liberal!
This change brings our wiki content formatting in line with how we
format other markdown at GitLab, so we have a SSOT for sanitization.
https://gitlab.com/gitlab-org/gitlab/issues/30540
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/markup_helper.rb | 10 | ||||
-rw-r--r-- | app/models/wiki_page.rb | 6 |
2 files changed, 7 insertions, 9 deletions
diff --git a/app/helpers/markup_helper.rb b/app/helpers/markup_helper.rb index d76a0f3a3b8..e2524938e10 100644 --- a/app/helpers/markup_helper.rb +++ b/app/helpers/markup_helper.rb @@ -133,15 +133,7 @@ module MarkupHelper issuable_state_filter_enabled: true ) - html = - case wiki_page.format - when :markdown - markdown_unsafe(text, context) - when :asciidoc - asciidoc_unsafe(text) - else - wiki_page.formatted_content.html_safe - end + html = markup_unsafe(wiki_page.path, text, context) prepare_for_rendering(html, context) end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 1fa29e5b933..68241d2bd95 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -134,6 +134,12 @@ class WikiPage @version ||= @page.version end + def path + return unless persisted? + + @path ||= @page.path + end + def versions(options = {}) return [] unless persisted? |