Patch + Test for Lighthouse Issue #2628


I've submitted a patch for a bug I came across in ActiveSupport under Ruby 1.9.1.

This issue is causing certain requests passing through ActionController to fail while preparing etags in actionpack-2.3.2/lib/ action_controller/response.rb due to the current implementation of String.blank?, which tests for blankness using a regular expression. If content in a database is retrieved by ActiveRecord and interpreted as valid ASCII-8bit but coerced to UTF-8 during the rendering process and used for etag generation in ActionController, the body.blank? test will fail with an unrescuable exception that results in no output being sent to the user.

I've also included a reduced test case for reproducing the bug, the original backtrace, and a patch for blank_test.rb demonstrating the failure under Ruby 1.9.1 and success following the application of the patch.

This is the first patch I've submitted to Rails core; I'd definitely appreciate any feedback.


Scott Andreas (@cscotta)