Skip to content

Commit

Permalink
Escape special chars in tooltip & text of TreeBuilder's root
Browse files Browse the repository at this point in the history
Those two items may contain characters which would make javascript
fail later down the road (apostrophes for example).

https://bugzilla.redhat.com/show_bug.cgi?id=1594480
  • Loading branch information
mzazrivec committed Jun 27, 2018
1 parent b391af1 commit 522bded
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/presenters/tree_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def add_to_sandbox
end

def add_root_node(nodes)
root = nodes.first.merge!(root_options)
root = nodes.first.merge!(%i(text tooltip).each_with_object(root_options) { |key, hsh| hsh[key] = ERB::Util.html_escape(hsh[key]) })
if root[:image]
root[:image] = ActionController::Base.helpers.image_path(root[:image])
else
Expand Down

0 comments on commit 522bded

Please sign in to comment.