Skip to content
Extraits de code Groupes Projets
Valider d8e891b4 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

Revert "escape js in format_tags until I can think about whether we have an...

Revert "escape js in format_tags until I can think about whether we have an XSS problem in the morning"

This reverts commit 8af95909.
parent 8af95909
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
module Diaspora module Diaspora
module Taggable module Taggable
extend ActionView::Helpers::JavaScriptHelper
VALID_TAG_BODY = /[^_,\s#*\[\]()\@\/"'\.%]+\b/ VALID_TAG_BODY = /[^_,\s#*\[\]()\@\/"'\.%]+\b/
def self.included(model) def self.included(model)
...@@ -40,7 +39,7 @@ module Diaspora ...@@ -40,7 +39,7 @@ module Diaspora
def self.format_tags(text, opts={}) def self.format_tags(text, opts={})
return text if opts[:plain_text] return text if opts[:plain_text]
regex = /(^|\s)#(#{VALID_TAG_BODY})/ regex = /(^|\s)#(#{VALID_TAG_BODY})/
form_message = escape_javascript(text).gsub(regex) do |matched_string| form_message = text.gsub(regex) do |matched_string|
"#{$~[1]}<a href=\"/tags/#{$~[2]}\" class=\"tag\">##{$~[2]}</a>" "#{$~[1]}<a href=\"/tags/#{$~[2]}\" class=\"tag\">##{$~[2]}</a>"
end end
form_message.html_safe form_message.html_safe
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter