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.

WEBrick serving files from /public produces routing error for files which have a "+" in their name

#6185

I have the following file: public/javascripts/jq+ui.min.js

When I attempt to view the file in my browser, rails generates an "Action Controller: Exception Caught; Routing Error; No route matches "/javascripts/jq+ui.min.js".

When I rename the file to: public/javascripts/jq-ui.min.js, the error is resolved and the file is served.

It rails apparently dislikes a "+" in the filename serving from public/

I am using Rails 3.0.3 ("development" environment), WEBrick 1.3.1, and Ruby 1.9.2 using RVM 1.1.3 on Ubuntu 10.10.

I've not tried it, but tests by others suggest that a setup using Apache is immune to this bug.

Reported by Andrew Dvorak · December 17th, 2010 @ 06:58 AM

State: open
Milestone: 3.x
Assigned to: Andrew White Andrew White
Importance: Low

Activity

  1. pnina
    pnina

    hi
    i encountered the same problem
    i just reinstall my computer and installed rails 3.0.3 and ruby 1.9.2 on windows 7 and WEBrick
    when I open my application in the browser rails cannot find my JavaScript files and i am getting ActionController::routingError
    I worked previously with rails 3.0 and all was fine

    January 3rd, 2011 @ 12:07 PM

  2. Andrew White
    Andrew White
    • State changed from new to open
    • Milestone set to 3.x
    • Assigned user set to Andrew White
    • Importance changed from to Low

    This is because the '+' is getting decoded as a space by Rack::Utils.unescape in ActionDispatch::Static and Rack::File. In production mode static file serving is handled by Apache so it works fine. Rack::Utils.unescape is very basic implementation in that it doesn't take into account the context of the + symbol which is allowed unescaped in paths but is treated as a space in query parameters.

    This needs fixing in both places for it to work - URI.unescape (or URI::Parser.unescape in 1.9.2) would seem to provide the necessary method.

    February 9th, 2011 @ 06:37 AM