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.

There was a problem

This is not a public project

This project is archived and is in readonly mode.

Button_to does not return an HTML-safe string

#3448

In the 2-3-stable branch, the button_to helper does not return a string marked as safe. I've made a small patch to fix it.

Reported by Bruno Michel · November 1st, 2009 @ 12:45 PM

State: committed
Milestone: 2.3.6
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Bruno Michel
    Bruno Michel
    • Tag changed from 2-3-stable, xss to 2-3-stable, patch, xss

    November 1st, 2009 @ 01:08 PM

  2. Bruno Michel
  3. Michael Koziarski
  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    Yes, you're right Bruno.
    First of all can you provide a failing test case?, and must say that your patch is wrong you're not on the current 2-3-stable branch.

    The actual code is:

    "<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" +
      method_tag + tag("input", html_options) + request_token_tag + "</div></form>".html_safe
    

    and should be:

    ("<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" +
       method_tag + tag("input", html_options) + request_token_tag + "</div></form>").html_safe
    

    not that is html_safe not html_safe!

    March 8th, 2010 @ 08:56 PM

  5. Bruno Michel
    Bruno Michel

    and must say that your patch is wrong you're not on the current 2-3-stable branch.

    Hey, I was on the 2-3-stable when I created the patch in October last year ;-) But html_safe! has been deprecated in favor of html_safe since (in January IIRC).

    First of all can you provide a failing test case?

    Sure, I've attached the new patch with a unit test.

    March 8th, 2010 @ 10:06 PM

  6. Bruno Michel
    Bruno Michel

    and must say that your patch is wrong you're not on the current 2-3-stable branch.

    Hey, I was on the 2-3-stable when I created the patch in October last year ;-) But html_safe! has been deprecated in favor of html_safe since (in January IIRC).

    First of all can you provide a failing test case?

    Sure, I've attached the new patch with a unit test.

    March 8th, 2010 @ 10:06 PM

  7. Bruno Michel
    Bruno Michel

    Hum, it looks like lighthouse has buged, and my last comment and patch were posted two times.

    March 8th, 2010 @ 10:08 PM

  8. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to verified

    March 9th, 2010 @ 11:12 PM

  9. Santiago Pastorino
    Santiago Pastorino
    • State changed from verified to committed

    March 22nd, 2010 @ 01:56 AM

  10. bingbing