Fixed Editor base64 image inserted but not submitted

Affected version
2.1.2

Lukas W.

Formerly katsulynx
Using the insert image function on the Froala editor to insert a base64 image string into the editor will add the image to the editor, but converting to BB code will remove the image, hence effectively removing it from the post. As google images renders a lot of images as base64 now, this should probably be prevented by the editor in some form.
 

Chris D

XenForo developer
Staff member
I'd definitely err on the side of this being sort of experimental but we've come up with something that should work better than just preventing them.

View attachment Screen Recording 2019-07-15 at 22.32.49.mov

Specifically, we've attempted to hijack a few Froala events and methods in order to detect a data URI and instead decode the base64 string and convert it to a blob and then upload it as an attachment.
 

Chris D

XenForo developer
Staff member
We're a little limited in what we can do in that case. It pretty much just silently fails and the image isn't inserted.

But this is likely preferable to the current behaviour. Currently the image would potentially disappear when switching modes as you noted or perhaps more likely is you will get a "Message too long to be submitted" error (if the base64 string length is longer than the max message length).
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.3).

Change log:
Attempt to upload images inserted via the editor using large data URIs.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top