U4-4425 - Umbraco Macros break on quote

Created by Mikael Hardø 13 Mar 2014, 14:00:04 Updated by Shannon Deminick 20 Mar 2014, 01:20:53

Relates to: U4-4442

Relates to: U4-4290

When i insert text into a macro that contains a quote (') it breaks the rendering of the Macro.

Steps to reproduce:

  1. Insert a macro in the RTE.
  2. Insert a quote in a textbox and press "Select"
  3. Everything is rendered as it should (all text is shown including the quote).
  4. Press save. The preview is now wrong (the text is truncated at the first quote in the text) - but the save is ok and the page looks like it should.

It is only in the RTE that the text is wrong, and if you try to edit the Macro again you will get the truncated text.

I included a macro that gives me this problem, but i have 3 macros with the same problem. {code:|title=Razor view for Macro} @inherits Umbraco.Web.Macros.PartialViewMacroPage



@{ var url = ""; var imageId = Model.MacroParameters["image"].ToString(); if (!string.IsNullOrWhiteSpace(imageId) && imageId != "null") { var image = Umbraco.TypedMedia(imageId).GetProperty("umbracoFile"); url = image.Value.ToString(); } }


Possible variant of same issue: http://issues.umbraco.org/issue/U4-4290#

4 Attachments


Mikael Hardø 19 Mar 2014, 12:08:35

The problem can be partially fixed by changing this: {code:lang=JavaScript|title=Line 2728 in umbraco.services.ks} var paramExpression = new RegExp("(\w+?)='"['"]", "g");

To this: {code:lang=JavaScript|title=Line 2728 in umbraco.services.ks} var paramExpression = new RegExp("(\w+?)="["]", "g");

As macros (to my knowledge) will be generated with the double quote ("), this lets us use a single quote (') in the text of the macros without breaking anything.

Priority: Major

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category: Editor

Backwards Compatible: True

Fix Submitted: Inline code

Affected versions: 7.0.1, 7.0.2, 7.0.3, 7.0.4

Due in version: 7.1.0


Story Points: