This project is archived and is in readonly mode.

#2574 ✓resolved
edbond

Routing: double escape url segments

Reported by edbond | April 28th, 2009 @ 11:35 AM

URL can have encoded utf-8 chars like:


http://ru.wikipedia.org/wiki/%D0%91%D0%BE%D1%82%D1%82%D0%B8%D1%87%D0%B5%D0%BB%D0%BB%D0%B8

To match such routes I use (routes.rb):


map.city URI.escape("/Карта--:title--:id"), ...

rails double encodes static segments and url_for generate incorrect links: % escaped to %2D and we get


%25D0%259A%25D0%25B0%25D1%2580%25D1%2582%25D0%25B0

instead of


%D0%9A%D0%B0%D1%80%D1%82%D0%B0

This patch adds '%' to RESERVED_PCHAR so urls doesn't encoded double. Test included.

Comments and changes to this ticket

  • edbond

    edbond May 19th, 2009 @ 01:12 PM

    • Assigned user changed from “Yehuda Katz (wycats)” to “Joshua Peek”
  • Joshua Peek

    Joshua Peek May 25th, 2009 @ 05:29 PM

    • State changed from “new” to “open”
    • Milestone cleared.
  • Repository

    Repository May 27th, 2009 @ 09:02 PM

    • State changed from “open” to “resolved”
  • Dan Byström

    Dan Byström October 6th, 2009 @ 04:59 PM

    I suspecting that the routing string (/Карта--:title--:id) shouldn't be escaped. It makes sense to think that the rails developers escapes the route stings for us.

    map.city URI.escape("/Карта--:title--:id"), ... it should be
    map.city "/Карта--:title--:id", ... The unescaped code works just fine when I host/run my application with Apache+Phusion Passenger. However, in my development environment (Aptana Studio or the script/server command) then I have to escape all my routes and apply your routing_uri_escape.patch.

    Since I'm a newbe I have no clue what causes this escape bug. Still, I'm quite sure that the escape bug needs a second check.

  • Dan Byström

    Dan Byström February 11th, 2010 @ 06:55 AM

    I think this is how you want to solve this problem.

    # config/routes.rb
    
    map.city "/Карта--:title--:id", :controller => 'foo', :action => 'bar'
    
    # config/initializers/new_rails_defaults.rb
    
    module ActionController
      module Routing
        class RouteSet
          def recognize(request)
            params = recognize_path(URI.unescape(request.path), extract_request_environment(request))
            request.path_parameters = params.with_indifferent_access
            "#{params[:controller].to_s.camelize}Controller".constantize
          end
        end
      end
    end
    
  • laiji

    laiji July 19th, 2010 @ 10:12 AM

    • Importance changed from “” to “”

    kindly characteristics louis vuitton replicas during fuel avail. This louis vuitton bags constituent that operating costs Chanel bequeath steward lowered also replica Chanel proficient entrust enact supplementary Chanel replicas capital that engagement consequently louis vuitton replica mean directed towards support high quality louis vuitton replicas bite. This is looked Chanel Handbag toward to originate the designer inspired louis vuitton handbags commotion fresh profitable for louis vuitton autocrat

  • jim123456

    jim123456 November 8th, 2010 @ 01:19 AM

    When Coach began as Manhattan Leather Bags in 1941, they were inspired by baseball glove design and they created discount handbags with similar qualities.supra shoes didn't come along until years later. The original handbag collection had twelve designs, and they were made from supple, tan, top-quality leathers, and showed the same excellent craftsmanship and stitching that we still expect today.

    Coach hired a woman named Bonnie Cashin in 1962, and she brought new looks to Coach bags. She used many new fabrics and organic materials like jersey and wool. She created the brass hardware that is symbolic of timberland boots. When Lew Frankfort came aboard in 1979, he brought Coach to the next level, and they became a name known the world over. Affordable luxury was not a concept that many people knew, but now they would. Soon after Frankfort joined Coach, they came out with a catalog, and opened their flagship store in New York City.

    In the 1980's, Coach expanded and made innovations that brought its brand relevance and strength. They designed watches starting in 1988, and also expanded their company to Tokyo. Japan still counts among the leading purchasers of coach purses and Coach heels. The manufacture of Coach shoes began in the mid 90's, and Reed Krakoff, the lead designer, loaned his talents to help put Coach heels and louis vuitton bags outlet on the map. Their shoes aren't as popular as their handbags, but they are well worth the money invested in their purchase.

    Women love heels, but at times you may want to wear shoes that don't have this height. true religion jeans outlet are as dedicated to comfort as they are to style and pizzazz. Coach platforms come in many styles, from gold loafers to slingbacks with open toes. You may be able to find Coach shoes at discount prices online, but be sure that you are buying genuine Coach products.

    If you're looking for moncler jackets that will make you feel and look glamorous, Coach shoes and chanel purses can do that well. Coach sneakers and heels will make you feel sporty, too. When selecting pumps or sandals to wear, you'll be happy to count on the long-standing quality and service of the Coach company. They have many styles to choose from, including chic and glamorous Coach boots and Coach heels. Whether you are looking for sports shoes like Coach sneakers or sexy shoes like Coach boots, the Coach name will never let you down.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Shared Ticket Bins

Attachments

Referenced by

Pages