Problem adding custom emojis

AI-generated summary

In a bug report regarding custom emojis, Lutz described an issue where adding oversized emojis caused errors in /logs after the upload appeared successful. The problem, originating from a security patch, stemmed from the ResizeEmoji job being queued with a relative path instead of an absolute one, leading to crashes when processing large animated GIFs. zogstrip initially suggested checking filenames, but Falco correctly identified the root cause as a relative path issue and referenced a proposed fix in pull request #4633. zogstrip approved the suggested solution, which successfully resolved the issue, prompting Lutz to confirm the fix worked.

We use custom emojis. Some of them are bigger than standard. We use the following CSS hack to display it nicely:

    /* Emoji Style */
    body img.emoji[title^=":_"] {
        width: initial !important;
        height: initial !important;
    }

This one, as example: (named :_bigboss:)

Since Beta 10 or 11 (we are on latest: v1.7.0.beta11 +38) adding new oversized emoji, generates this error:

    /var/www/discourse/app/models/optimized_image.rb:110:in `block in ensure_safe_paths!'
    /var/www/discourse/app/models/optimized_image.rb:109:in `each'
    /var/www/discourse/app/models/optimized_image.rb:109:in `ensure_safe_paths!'
    /var/www/discourse/app/models/optimized_image.rb:135:in `resize_instructions_animated'
    /var/www/discourse/app/models/optimized_image.rb:192:in `downsize_instructions_animated'
    /var/www/discourse/app/models/optimized_image.rb:213:in `optimize'
    /var/www/discourse/app/models/optimized_image.rb:205:in `downsize'
    /var/www/discourse/app/jobs/regular/resize_emoji.rb:14:in `execute'
    /var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

[code]

hostname dragon-app
process_id 110
application_version [a481bf048facd5e0c9a896d52f210b450c5a3d08, d8be3e8bb10f02912107803b28a1aa08080c9f81]
current_db default
job Jobs::ResizeEmoji
problem_db default
opts
path public/uploads/default/_emoji/_bigboss.gif
current_site_id default
[/code]

Other emjoi we added before, are still working without any problems.

1 Like

What’s the name of the file you’re uploading? If it has “:” in it, just remove them.

The name of the file is “_bigboss.gif” - as you can see in the second last line of the backtrace.log
The error also occurs if I name it “bigboss.gif” or if I try any other oversized emoji.

I just uploaded the emoji just fine here :_bigboss: (removed the emoji)

1 Like

Yes the upload works. Now wait a few Minutes and have a look at your /logs

I can also use it, but getting a lot of errors in the log is not good :slight_smile:

This broke on last security patch.

The job is being queued with a relative path.

What do you think about this @zogstrip : FIX: Use full path for emoji resize job by xfalcox · Pull Request #4633 · discourse/discourse · GitHub ?

3 Likes

Ok, I did not understand that.

Looks good to me :thumbsup:

6 Likes

The issue is completely solved. Thanks again, you guys are awesome!

2 Likes