MyBB Community Forums

Full Version: Another image bug in editor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I haven't upgraded my forum to 1.8.21 yet, thought it would be better to try & test things in community forum to see if anything is wrong. Well..

Description: When you paste an image directly to editor, it creates huge URL (like 800k characters.) Forum can't show the image and trying to edit the message with 800k characters gives you "1406 - Data too long for column 'originaltext' at row 1" MySQL error.

Reproduction steps:
  1. Right click on any image and click on "Copy image" (not link of image, but image itself)
  2. Paste this image on message editor with Ctrl V
  3. Notice that instead of your image you see that 800k characters between IMG codes.

Thread I tested it in Community Forums: https://community.mybb.com/thread-223398...pid1330487
Did you ever try to do the same in earlier version of MyBB with old SCEditor?
When you paste an image in editor directly the image gets converted to data-uri in latest SCE.
Sadly our parser doesn't support image tag with data-uri yet.

This has been discussed and likely to be implemented in future version of MyBB
https://github.com/mybb/mybb/issues/2440
This function worked in every MyBB version I used so far. My forum is still in 1.8.20 and it works there. Changes in 1.8.21 causes this and I reproduced it in community forums, got MySQL error for it.

If someone can break your forum by using simple functions like pasting an image directly to your editor and then get MySQL error when they try to fix that mess, this should not be something "discussed and likely to be implemented in future version."
The Community Forums take advantage of multiple MyBB extensions, so it may not always work in the same way as default MyBB installations. The SQL error appears to be related to a plugin we recently installed and other custom adjustments - thanks for bringing it to our attention.

Are you sure you didn't use plugins to handle the raw data URI scheme when viewing posts? As mentioned, it doesn't look like MyBB's core parser had support for that.

This discrepancy is one of many examples of friction between WYSIWYG editors (that have to be updated) and the parser (which may support different features in subsequent versions) - see the recent 1.9's editor discussion for more details.
Previously, when you paste an image directly to editor it wouldn't create data URI scheme, instead it would actually take image's original link. Now, whenever you paste an image directly, it creates very long text between IMG codes depending on image size and break the forum.

This is not an issue of MyBB not supporting data URI. I don't expect new functions. This is an issue of every image that directly pasted becoming data URI scheme while in previous version that wasn't the case and it worked perfectly. I don't need MyBB to support data:// stuff, I need users to be able to paste image directly to the editor and not breaking the forum while doing that.

---

I am right clicking on one of the smilies next to the editor, clicking Copy Image and pasting it on the editor.

This is the code editor provides for that action now:

[img]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAfCAYAAAAIjIbwAAAEVklEQVRIDa1VbWwUVRQ9M2wpu+5XWbstYSNaG0URMFWrUUH8KGjCglFSSCtqmlADJpoAMWoaqviHII24mqYpSqgYG0iRxIoFKmJDjaCIBVOxssFWEUvF0oJSKLtzzX0z7+3Mdlf94SaT995575577rlvZoG0X7znGKVBYvnb6T66cH5ozB5jvJcpRmArn5lPD94epIX3T3EcbGpcJ3De69z/sSLoOnxA4fV1LynckYCzslIOZiK5yTg/ldEZxIklziPja1ZXihiJ63LCo88f1K7yBQQ0s+QetcU4PwzMvO1ehfOEca83MAZ3HGIl619Z4VDDB1g5K3UcBiAtyOqrLJ1LSg9mn+1+yn0uPauffIjJOLMMsI+MZ0rGQrKqZAJWkt55xjkom9LqilljlDoaJZWx8Zl+XquJ6Xuyuen4/7oW1+SfGLuPfUU/xbvVkbxQAfi6eX2BrLEZN5LJBG3f+hZad2xGyP8rrrtGA8js37lzhKPHCffNfRLRx6tww023ZuRQKniyp/UDKisN0saafDpzZBJR3ySi3gKik/lE8avJODGRRruDtKshQIvLgtQYqx1zWxxZtm2NUct7tVj7shtTi1mdARiGqdIwQDw3SGBkEEZGDKxv1BEqWobnX6xTXKr7n7d/SNu21CK2zmMRkknGZac9ZK3ducCaZxMY7tuEho01SrEi/ahlM2pf8KCwgBOmERkESSRHTsRq+eiqp0fx9f4YDnbuFcSCdN/uFgrkHsKMabpNlYGHFl0WaxI2cNnmM/epcSoJk493AVWPJtC6413RH0HKi8eiOaaH9lL5iG2tVNpwiZVOS+B0vA29J38g/fzwIPWeOIibb2T+tLIFp4nJYJFEkFoJhQWmPXdNT+DLjjbo8Z7vUFykQ9ckodVtIrQ366pkUTr7SIQ974xatpg6ZDWRMOHUz3How0NnEfBbl9tWqjzIY0qlpc6B8b6wEnk+A4N/nIHudnsxMiJVWuO/dFuw2MqWAi5dBtweL/TCyVPQP8Alp8pO77ZTraWM1anKTBsGBjWECyNwXVs0VauITqeB3/sRDtkPEsqW8p3lR11ns04Au+svCk4BWORHf3Rh4bJZcDH4wLxF+OxADEsWaMq/sieAvU1J0SjzkqdeT2Z7eLkHbW//aaoF4eyQhiM9Lqy9c46QgYH+U1S95BY0vaHD57EH8/tuXXr5BgkvLdyygBv5ZvMETC55DZVVqzRRV7gwoi1YvBqvNxgwkv+929LTzi4XLnnLBSFXrsyqWl6jFRRXo24TkLhiXXihyvI5Q7f5ZTn8vQsb3neLb6s0XH2uJMB/tz3f1GNFRRLXR8wbkbIgVfZfF4GWfTnY/mkuXt3QjLtnP6K41ESS8rhr5xbir1b+hC7MviOJSNhAjk4YvUIYvgB8e3wc2g/lYH75SpQvfQ7+QJ6Dx7GwE/P8i45PqKN9J37piyORGIXLNR7BvBBKSudgXrQC/sDEjPF/A2SiKmCC6SceAAAAAElFTkSuQmCC[/img]

This is the code editor provided for that action until MyBB 1.8.21:

[img]https://community.mybb.com/images/smilies/huh.gif[/img]
I'd like to see the url what placed if you paste a raw data from clipboard.
Whatever it is, it is like this way and it is as how SC Editor is designed.
I want to make this clear:
  • I don't care about data URI stuff.
  • I don't care about how SC Editor is designed.
What I care about is:
  • Users using forum functions they were able to use yesterday and not breaking the forum, causing 800k characters in post in the meanwhile.
Currently, when you paste an image directly to editor, it creates thousands of characters as IMG source, breaks forum, causes issues. MyBB doesn't allow more than 65k characters in a post by default. If you simply go to test forum and look at my thread you can see post with 800k characters, that's what happened when I tried to paste an image from twitter to forum. I am repeating: I don't care if it's MyBB not supporting data URI or it's how SC Editor designed. It's causing issues. When I try to edit that message I got MySQL error and I have exact same plugin that caused that: Edit History.

I know that bugs might happen, stuff might get broken. I am using MyBB for 4 years. What saddens me here is not bug happening, but staff not acknowledging it's being an issue and talking about MyBB likely to implement data URI support or it's simply how SC Editor works. If you are using this editor in your forum by default, and using simple feature causes 800k character long posts, it's part of your thing.

I have waited 5 months to finally have fix for editor bugs in 1.8.20 and now I can't even update my forum because of this bug. Because I don't want my users simply break the forum, create posts with thousands characters and write to me saying there's something wrong with my forum simply because they pasted an image.

I am writing this because I want MyBB to better, we are in same boat, I am using MyBB in my forum and I will keep using it. But the approach in this thread is really saddening. As I say in every chance, I am not familiar with coding but just trying to be helpful, so there's my suggestion on this matter: Still have the latest SC Editor in MyBB, have pasting and image function modified to how it worked previously so it stays compatible.
(2019-06-14, 02:47 PM)Darkrad Wrote: [ -> ]I have waited 2 months to finally have fix for editor bugs in 1.8.20 and now I can't even update my forum because of this bug. Because I don't want my users simply break the forum, create posts with thousands characters and write to me saying there's something wrong with my forum simply because they pasted an image.

I am writing this because I want MyBB to better, we are in same boat, I am using MyBB in my forum and I will keep using it. But the approach in this thread is really saddening. As I say in every chance, I am not familiar with coding but just trying to be helpful, so there's my suggestion on this matter: Still have the latest SC Editor in MyBB, have pasting and image function modified to how it worked previously so it stays compatible.

Here's my big question to you...

Are you allowing your users to post RAW images directly from their desktops/remote devices?

If so, I am not certain (the MyBB developers can correct me on this), but I think a LINK has to be created in order for the image to show up properly in a post/thread in the forum. 

I do recall almost 2 years ago when I first started using MyBB and I had attempted to post an image directly from my desktop, wow... it's like what you described... a bunch of characters that took up a few pages. That told me immediately that the editor (Full or Quick) are not capable of handling that kind of raw image data. 

So, until someone in the future creates something that can transform that raw image data into something that an editor can handle, we should be using links to image hosting websites such as Imgur or Gyazo. 

Just my 2 cents in this.
It's easier for such issues to slip in, given they're not documented as official features that MyBB supports (like drag & drop and pasting images).

Original image URLs, instead of data URIs, would be one of many peculiarities that users may take advantage of in MyBB - some may be unknown to developers, or outright classified as bugs rather than features (similar example: https://github.com/mybb/mybb/issues/3383 - undocumented HTML support in security questions → HTML disabled → something breaks, which gets reported → MyCode support added, addressing main problem).

If you're looking for a quick fix, adding false&& to the
if(yt.FileReader&&s&&kt.test(s[c].type))
condition, which would become
if(false&&yt.FileReader&&s&&kt.test(s[c].type))
in the minified /jscripts/sceditor/jquery.sceditor.bbcode.min.js file may revert this change.
Pages: 1 2 3