Merge pull request #707 from ZmagoD/pdf_export

fixes export pdf error on production
This commit is contained in:
Zmago Devetak 2017-06-22 17:11:19 +02:00 committed by GitHub
commit 77a1848f6d
2 changed files with 9 additions and 1 deletions

View file

@ -99,4 +99,12 @@ module ReportsHelper
end
"<span class=\"label label-#{style}\">#{text}</span>".html_safe
end
def sanitize_report_pdf(text, tags = [], attributes = [])
ActionController::Base.helpers.sanitize(
text,
tags: Constants::WHITELISTED_TAGS + tags,
attributes: Constants::WHITELISTED_ATTRIBUTES + attributes
)
end
end

View file

@ -10,7 +10,7 @@
<body class="print-report-body">
<div class="print-report">
<% # Also whitelist <img> and <input type="checkbox"> tags %>
<%= sanitize_input(@html, ['img', 'input'], ['type', 'disabled', 'checked']) %>
<%= sanitize_report_pdf(@html, ['img', 'input'], ['type', 'disabled', 'checked']) %>
</div>
</body>
</html>