joshfrench / rakismet

Easy Akismet and TypePad AntiSpam integration for Rails
MIT License
355 stars 46 forks source link

undefined method `bytesize' for nil:NilClass in Rails 3.0.8 and 3.0.9 #13

Closed bnferguson closed 13 years ago

bnferguson commented 13 years ago

Ran into a problem when passing a Safebuffer string to Rakismet in rails 3.08 and 3.09. Essentially finding that it'd cause an exception when it tried the CGI.escape (which returns nil on a Safebuffer string).

I originally reported the issue here: https://github.com/rails/rails/issues/1739

Anyway, the solution was to change the to_s (returns self when it's a Safebuffer) to a to_str (returns an unsafe copy for the string when it's a Safebuffer).

Have this currently running in production for our use case - can't speak on how this might affect others.

Thanks! -Brandon

joshfrench commented 13 years ago

Thanks Brandon! Merged & pushed as 1.1.1.

bnferguson commented 13 years ago

Awesome! Thank you!