ActionView::Template::Error resulting in 500s after upgrade 1.5 -> 1.6.1

(pjv) #1

I just upgraded a forum from v 1.5.3 to 1.6.1 and post the upgrade, I am getting 500 errors on trying to view certain topics. This forum is integrated with WordPress running the WP Discourse plugin (to which I am a code contributor), and the issue seems to be specifically associated with topics that are discussions of blog posts where the first comment in the topic is a summary excerpt of the blog post.

I only see the 500 error when trying to view the “top” of the topic. In other words, if the discourse URL ends with the topic ID, I’ll get a 500 error. If it ends with a comment number after the topic ID, then it works fine.

Here is an example:


500 error:

The error log is showing me this:

ActionView::Template::Error (undefined method `length' for nil:NilClass)
/var/www/discourse/lib/excerpt_parser.rb:122:in `characters'

Here is the full backtrace:

(pjv) #2

Digging further, I’ve determined that the error is caused by specific content that we include in the blog post excerpt to help people coming from the WordPress post figure out what to do if they want to join the discussion. At the bottom of the excerpt of the blog post, we have the following lines:


To leave a comment, click the Reply button below

If you do not see the “Reply” button, you will need to log in or register an account. Please click the blue “Log In” button in the upper right of the page. <img class="emoji" src="/images/emoji/emoji_one/arrow_upper_right.png">

And it is specifically that html img link (which renders a little blue arrow pointing to the upper right corner of the page) that is causing the error. That code used to work fine in discourse v 1.5.x but breaks in 1.6.1.

(Jay Pfaffman) #3

I believe that the emoji must have moved in the newer version. You need to find the new place (or just enter the colon code for the emoji you want.

A recent #howto describes how to do a global replace.

I can’t find all that on this tablet,but maybe this will help.

(pjv) #4

Thank you! I am obviously emojinally challenged (I never use them so had no idea you could use a simple “colon code” to put them in). Thanks for the global replace link too - that will help.