<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *2.2.1 [RC2 or 2.2 final]*
 
+* Fixed the sanitize helper to avoid double escaping already properly escaped entities #683 [antonmos/Ryan McGeary]
+
 * Fixed that FormTagHelper generated illegal html if name contained square brackets #1238 [Vladimir Dobriakov]
 
 * Fix regression bug that made date_select and datetime_select raise a Null Pointer Exception when a nil date/datetime was passed and only month and year were displayed #1289 [Bernardo Padua/Tor Erik]</diff>
      <filename>actionpack/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -160,7 +160,7 @@ module HTML
         if !options[:attributes].include?(attr_name) || contains_bad_protocols?(attr_name, value)
           node.attributes.delete(attr_name)
         else
-          node.attributes[attr_name] = attr_name == 'style' ? sanitize_css(value) : CGI::escapeHTML(value)
+          node.attributes[attr_name] = attr_name == 'style' ? sanitize_css(value) : CGI::escapeHTML(CGI::unescapeHTML(value))
         end
       end
     end</diff>
      <filename>actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -253,6 +253,10 @@ class SanitizerTest &lt; Test::Unit::TestCase
     assert_sanitized &quot;&lt;![CDATA[&lt;span&gt;neverending...&quot;, &quot;&amp;lt;![CDATA[&amp;lt;span&gt;neverending...]]&gt;&quot;
   end
 
+  def test_should_not_mangle_urls_with_ampersand
+     assert_sanitized %{&lt;a href=\&quot;http://www.domain.com?var1=1&amp;amp;var2=2\&quot;&gt;my link&lt;/a&gt;}
+  end
+
 protected
   def assert_sanitized(input, expected = nil)
     @sanitizer ||= HTML::WhiteListSanitizer.new</diff>
      <filename>actionpack/test/controller/html-scanner/sanitizer_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 *2.2.1 [RC2 or 2.2 final]*
 
-* Stop logging SHOW FIELDS and SET SQL_AUTO_IS_NULL=0 as they only clutter up the log and offer no value [DHH]
+* Stop logging SHOW FIELDS and SET SQL_AUTO_IS_NULL=0 for the MysqlAdapter as they only clutter up the log and offer no value [DHH]
 
 * Ensure indices don't flip order in schema.rb #1266 [Jordi Bunster]
 </diff>
      <filename>activerecord/CHANGELOG</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>077773257b682b7929e77ced3bbf46acf56a10c9</id>
    </parent>
  </parents>
  <author>
    <name>David Heinemeier Hansson</name>
    <login>dhh</login>
    <email>david@loudthinking.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/a358d87e16fa876de29286b69474ab6aaee4a80b</url>
  <id>a358d87e16fa876de29286b69474ab6aaee4a80b</id>
  <committed-date>2008-11-06T04:02:32-08:00</committed-date>
  <authored-date>2008-11-06T04:02:32-08:00</authored-date>
  <message>Fixed the sanitize helper to avoid double escaping already properly escaped entities [#683 state:committed]</message>
  <tree>6d5a68b1948a2727fb515c794f1e4854c8eedb3e</tree>
  <committer>
    <name>David Heinemeier Hansson</name>
    <login>dhh</login>
    <email>david@loudthinking.com</email>
  </committer>
</commit>
