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.

Rails inflector "parameterize" vs. + signs

#4080

I was wondering if it wouldn't be better to not include + signs into the rails "parameterize" as it is used to "replace special characters in a string so that it may be used as part of a ‘pretty’ URL.".

The method can be found in in

active_support/inflector

The regional expression that is used allows + signs;

      parameterized_string.gsub!(/[^a-z0-9\-_\+]+/i, sep)

However the + sign can be wrongly identified by the browser, not as a + sign, but as a space. Possibly resulting in errors like;

      ArgumentError: illegal character in key

I'll be happy to write a patch and run it through its associated tests if that would help!

Thanks to all you guys for delivering the best framework ever!

Reported by stijn (at skylight) · March 1st, 2010 @ 08:10 PM

State: committed
Milestone: 2.3.6
Assigned to: nobody
Importance: none

Activity

  1. José Valim
    José Valim

    Please do provide a patch then! :)

    March 3rd, 2010 @ 08:33 AM

  2. stijn (at skylight)
    stijn (at skylight)
    • Tag set to patch

    This is the fix for the described problem for the 2-3-stable branch. I'll try to add one as well for master branch as well.

    March 5th, 2010 @ 06:53 AM

  3. stijn (at skylight)
    stijn (at skylight)

    And here is the fix for the master branch.

    Is it normal that the patch file for 2-3 stable is so big and this one is so small?

    March 5th, 2010 @ 07:06 AM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to verified
    • Tag changed from patch to 2.3.x, 3.0, patch
    • Milestone set to 2.3.6

    stijn master patch works fine.
    I'm providing the right 2-3-stable patch with Stijn Mathysen stijn@skylight.be as the author.

    March 5th, 2010 @ 10:08 PM

  5. Repository
    Repository
    • State changed from verified to committed

    (from [f6f75e84c5a186ea4c689dd8b7ae0da391c226ef]) Removed the + sign as an accepted character from the parameterize method, as a + sign is interpreted by the browser as a space, possibly resulting in a "ArgumentError: illegal character in key"

    [#4080 Rails inflector "parameterize" vs. + signs state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/f6f75e84c5a186ea4c689dd8b7ae0d...

    March 5th, 2010 @ 10:11 PM

  6. Repository
    Repository

    (from [67512b9489593ddcd1c0c87ba0052380355b5400]) Removed the + sign as an accepted character from the parameterize method, as a + sign is interpreted by the browser as a space, possibly resulting in a "ArgumentError: illegal character in key"

    [#4080 Rails inflector "parameterize" vs. + signs state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/67512b9489593ddcd1c0c87ba00523...

    March 5th, 2010 @ 10:11 PM