Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Problem with attribute escaping (sanitized.rb) +patch

#714

When you have a URL with an ampersand in an attribute, it is escape each time you edit that field. What happens over time is the escaped ampersand also get escaped, resulting in something like this:

&

V

&

V

&

V

&

V

etc

When used in conjunction with things like TinyMCE, it makes it impossible to have links (that is, <a href=""> tags with an & in the href attribute) in the body.

(note though that this does happen without TinyMCE, but its more noticeable with TinyMCE because it escapes URLs automatically before it gets to Rails, so the link is broken when a record is made).

I have an attached a simple fix which when applied to my code, fixed all the problems I encountered. Basically, you turn &amp; to & and back to &amp;. How this fixes the issue is already escaped data is changed back, and then re-escaped, preventing escape build up.

Hope this helps.

Reported by Kieran P · July 28th, 2008 @ 07:21 AM

State: duplicate
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. josh
    josh
    • State changed from new to stale

    Staling out, please reopen if this is still a problem.

    October 28th, 2008 @ 04:34 PM

  2. Kieran P
    Kieran P
    • Assigned user set to josh

    The issue still exists. The patch above is still valid.

    October 28th, 2008 @ 08:30 PM

  3. Walter McGinnis
    Walter McGinnis

    +1 On Oct 29, 2008, at 9:30 AM, Lighthouse wrote:

    October 28th, 2008 @ 08:40 PM

  4. John Burmeister
    John Burmeister
    • Tag changed from 2.1, actionpack, bug, patch, sanitized, tiny to 2.1, 2.2, actionpack, bug, patch, sanitize, sanitized, tiny

    Patch works great, please fix. +1

    October 30th, 2008 @ 12:17 AM

  5. josh
    josh
    • State changed from stale to open
    • Assigned user cleared.

    November 2nd, 2008 @ 04:19 PM

  6. theflow
    theflow

    this is duplicate of #683 Problem with RailsSanitize.white_list_sanitizer.sanitize (which proposes the same solution and includes a test)

    November 6th, 2008 @ 11:14 AM

  7. Pratik
    Pratik
    • State changed from open to duplicate

    March 6th, 2009 @ 07:21 PM