Skip to content

Instantly share code, notes, and snippets.

View bensomers's full-sized avatar

Ben Somers bensomers

  • San Francisco, CA
View GitHub Profile
@bensomers
bensomers / rails_routing_invalid_chars_fix.rb
Created May 29, 2012 19:08
3.0.x monkeypatch for fixing Invalid Char 500s
# Fix for a Rails - Ruby 1.9 bug
# Rails Router, now that it's UTF-8 default, blows up when routing requests
# with invalid chars in the URL; it should properly return a 400 error
# Have to monkey-patch the fix in, since it's not scheduled for release until
# Rails 4.0.
# Adapted Andrew White (pixeltrix)'s fix at
# https://github.com/rails/rails/commit/3fc561a1f71edf1c2bae695cafa03909d24a5ca3,
# but edited to work in 3.0.x.
# 3.1.x, 3.2.x compatibility unknown
require 'action_dispatch/routing/route_set'