GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fixed that single quote was not escaped in a UrlHelper#link_to javascript 
confirm #549 [Scott Barron]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@837 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Sun Mar 06 04:07:13 -0800 2005
commit  0bc8e09f8057b6745fedb08e4af10bc554ac3f41
tree    f61ce9d31d432a7c25284509b8309c270ebe2775
parent  eb5ca2ea5ff55e2f6a49580afab5e0ddd0b2bf11
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Fixed that single quote was not escaped in a UrlHelper#link_to javascript confirm #549 [Scott Barron]
0
+
0
 * Removed the default border on link_image_to (it broke xhtml strict) -- can be specified with :border => 0 #517 [?/caleb]
0
 
0
 * Fixed that form helpers would treat string and symbol keys differently in html_options (and possibly create duplicate entries) #112 [bitsweat]
...
138
139
140
141
 
142
143
144
...
138
139
140
 
141
142
143
144
0
@@ -138,7 +138,7 @@ module ActionView
0
       private
0
         def convert_confirm_option_to_javascript!(html_options)
0
           if confirm = html_options.delete("confirm")
0
- html_options["onclick"] = "return confirm('#{confirm}');"
0
+ html_options["onclick"] = "return confirm('#{confirm.gsub(/'/, '\\\\\'')}');"
0
           end
0
         end
0
     end
...
27
28
29
 
 
 
 
30
31
32
...
27
28
29
30
31
32
33
34
35
36
0
@@ -27,6 +27,10 @@ class UrlHelperTest < Test::Unit::TestCase
0
       "<a href=\"http://www.world.com\" onclick=\"return confirm('Are you sure?');\">Hello</a>",
0
       link_to("Hello", "http://www.world.com", :confirm => "Are you sure?")
0
     )
0
+ assert_equal(
0
+ "<a href=\"http://www.world.com\" onclick=\"return confirm('You can\\'t possibly be sure, can you?');\">Hello</a>",
0
+ link_to("Hello", "http://www.world.com", :confirm => "You can't possibly be sure, can you?")
0
+ )
0
   end
0
 
0
   def test_link_image_to

Comments

    No one has commented yet.