This project is archived and is in readonly mode.

#6185 open
Andrew Dvorak

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

Reported by Andrew Dvorak | December 17th, 2010 @ 06:58 AM | in 3.x

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.

Comments and changes to this ticket

  • pnina

    pnina January 3rd, 2011 @ 12:07 PM

    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

  • Andrew White

    Andrew White February 9th, 2011 @ 06:37 AM

    • 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.

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>

Pages