Fix `error "undefined method `bytesize' for nil:NilClass"`

This was being caused by a SafeBuffer going into CGI::escape.
The fix/workaround is to .to_str the input so a regular string is going in instead.