U4-638 - Bug (and fix/solution): Saving inline base64 image (or any attribute value with equal sign at the end)

Created by Sebastiaan Janssen 19 Aug 2012, 14:55:11 Updated by Sebastiaan Janssen 18 Jul 2013, 15:10:06

Steps to reproduce:

  1. Copy & paste an image or print screen to TinyMCE.
  2. Save document.
  3. Reload document.
  4. Image is lost.

Cause: The Regex the find attribute names and values in umbraco.editorControls.tinymce.tinyMCEImageHelper.cleanImages(string html) for each tag matches the attribute name greedy. If the attribute value ends with an equal sign, it is treated as the attribute name. See attached screenshot from The Regex Coach.

Fix: .\components\editorControls\tinymce\tinyMCEImageHelper.cs, Line 32:

  • "(?\S*)="(?["])"|(?\S)=(?["|\s]*)\s",
  • "(?\S*?)="(?["])"|(?\S?)=(?["|\s]*)\s",

''Originally created on CodePlex by [IndR|http://www.codeplex.com/site/users/view/IndR]'' on 8/5/2012 11:37:18 PM [Codeplex ID: 30976 - Codeplex Votes: 1]

Imported comments

''Comment by [IndR|http://www.codeplex.com/site/users/view/IndR] on 8/5/2012 11:39:11 PM:'' ... and the screen shot with lazy quantifier.

2 Attachments


Sebastiaan Janssen 23 Jun 2013, 13:55:57

I am unable to past an image into TinyMce so I think that feature might've gone away after we upgraded to a newer version of it last year.

I can paste some data in there though so when I put this in the HTML, everything saves just fine: Red dot

Fraser Skea 23 Jun 2013, 19:13:32


Thanks for having a look at this. When I was seeing this issue I was just pasting into the HTML too. I can confirm that that this red dot example does work for me as well.

I am however seeing this issue happening consistently for a lot of images, on several Umbraco installs. Would the best course be to raise a new bug with these examples?


Sebastiaan Janssen 24 Jun 2013, 08:02:41

No need, just re-open the issue with an example that's reproducible!

Fraser Skea 25 Jun 2013, 14:10:29


The following example seems to strip all the attributes from the image tag. I am opening the html view for a rich text area and pasting this in. It shows correctly until save and publish and then the attributes are stripped out.

plot of chunk unnamed-chunk-2

Sebastiaan Janssen 18 Jul 2013, 15:09:56

Thanks Fraser for the example! Fixed in changeset d88494e90ed2a096cc1cec4c43c7c5e1436acf79

Priority: Normal

Type: Bug

State: Fixed


Difficulty: Easy


Backwards Compatible: True

Fix Submitted: Inline code

Affected versions: 4.11.9, 4.11.8

Due in version: 6.1.3


Story Points: