SOLVED: Grid issue setting background-image in a grid row
Good Day All
With the upgrade yesterday to 7.5.6 there is a bug in the grid when you have the background-image style set on your grid. A utility function was added to bootstap3.cshtml called CleanForXss on line 79:
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
well the issue is that this will take the value based on this setting in the grid:
[
{
"label": "Set a background image",
"description": "Set a row background",
"key": "background-image",
"view": "imagepicker",
"modifier": "url({0})"
}
]
which creates this based on the url({0}):
url(/media/2035/banner1.jpg)
but right after this utility function is run the value is:
urlmedia2035banner1.jpg
and this gets inserted into the grid row as:
style="background-image:urlmedia2035banner1.jpg" which as you probably suspect no longer renders your background.
I will submit a bug for this but for a quick fix just remove the function call:
var propertyValue = property.Value.ToString();
This will affect any 7.5.6 version. I checked the previous version and it did not have this function call. Not sure why it is added it looks like it is trying to sanitize the string against attack but this data only comes from umbraco backend so not sure why it is required, it is never client entered.
You should maybe reopen the bug in the tracker. It is HERE. It is a bit different but I think this will affect anything getting rendered through there. You will have upgrade issues if you fix it yourself, especially if you using Umbraco Cloud.
SOLVED: Grid issue setting background-image in a grid row
Good Day All
With the upgrade yesterday to 7.5.6 there is a bug in the grid when you have the background-image style set on your grid. A utility function was added to bootstap3.cshtml called CleanForXss on line 79:
well the issue is that this will take the value based on this setting in the grid:
[ { "label": "Set a background image", "description": "Set a row background", "key": "background-image", "view": "imagepicker", "modifier": "url({0})" } ]
which creates this based on the url({0}): url(/media/2035/banner1.jpg)
but right after this utility function is run the value is: urlmedia2035banner1.jpg
and this gets inserted into the grid row as: style="background-image:urlmedia2035banner1.jpg" which as you probably suspect no longer renders your background.
I will submit a bug for this but for a quick fix just remove the function call:
This will affect any 7.5.6 version. I checked the previous version and it did not have this function call. Not sure why it is added it looks like it is trying to sanitize the string against attack but this data only comes from umbraco backend so not sure why it is required, it is never client entered.
Got an issue that looks alot like that .. :)
We'll use the "Headline" grid element, and for an example when the text is
"We'll help you & support you"
It will remove the "&" in the text.
I removed the "TemplateUtilities.CleanForXss" function as well.
So instead of this
I will look like this
Hey Anders.
You should maybe reopen the bug in the tracker. It is HERE. It is a bit different but I think this will affect anything getting rendered through there. You will have upgrade issues if you fix it yourself, especially if you using Umbraco Cloud.
Geoff
Yeah i know i will get issues but i just had to fix it right now .. :)
This site is not on Cloud so, they are only upgrading when we do it .. :)
I hear ya. I did exactly the same thing ;).
is working on a reply...