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.

http request values converted wrong in special case

#4453

Hi,

I'm using Rails 2.3.4.

Following situation:
You have a call like "/books/show?name=the+name"
as you can see the space between "the" and "name" is correctly replaced by a "+"
now you change the route to "/:name" and create a link_to "example", :controller => :books, :action => :show, :name => "the name"
and you get "/the name" without the space replaced.
That's wrong I think!? It should also be replaced by a "+".

If it is not clear: it is only the case if you rename a route like I did above.

Edit: The Problem is: Rails should generate a valid and working url, an url like "/the name" is equivalent to "/the", that's no good deal. Rails should convert all chars of the passed vars the way like chars are always converted for urls. If a space becomes a "%20" or "+" doesn't matter but there are often many chars that need to be converted. At least we need something like h() for urls.

Yours Joern.

Reported by Joern Akkermann · April 22nd, 2010 @ 08:35 AM

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Jeff Kreeftmeijer
    Jeff Kreeftmeijer

    If you do this;

    link_to "example", :controller => :books, :action => :show, :name => "the name"
    

    You're specifically passing the string "the name". I don't think rails should replace that space with a '+', since you specified you wanted a space there.

    And, what do you mean by "You have a call like "/books/show?name=the+name""? I don't really understand what you're talking about.

    I think this one is invalid, but we probably need more info...

    April 22nd, 2010 @ 09:29 AM

  2. Ryan Bigg
    Ryan Bigg
    • State changed from new to needs-more-info

    What bug is this causing? If it's just "the URL doesn't look pretty" then that's not a Rails issue.

    April 22nd, 2010 @ 11:51 AM

  3. Joern Akkermann
  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from needs-more-info to open
    • Importance changed from to Low

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:43 PM

  5. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:43 PM