Skip to content

Commit f9188ab

Browse files
donkerbdukes
authored andcommitted
Fix for wrong parsing of HtmlAttributesAsString
1 parent 23d4650 commit f9188ab

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

DNN Platform/DotNetNuke.Web.Client/Controls/ClientResourceInclude.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,30 @@ private static void ParseHtmlAttributesIntoDictionary(string attributes, IDictio
120120
return;
121121
}
122122

123+
var charArray = attributes.ToCharArray();
123124
var key = string.Empty;
124125
var val = string.Empty;
125126
var isKey = true;
126127
var isVal = false;
127128
var isValDelimited = false;
128129
for (var i = 0; i < attributes.Length; i++)
129130
{
130-
var c = attributes.ToCharArray()[i];
131+
var c = charArray[i];
131132
if (isKey && c == ':')
132133
{
133134
isKey = false;
134135
isVal = true;
135136
continue;
136137
}
137138

139+
if (isKey && c == ' ')
140+
{
141+
// this means we have a key without a value, we should add it to the dictionary with an empty value and start a new key
142+
destination[key] = string.Empty;
143+
key = string.Empty;
144+
continue;
145+
}
146+
138147
if (isKey)
139148
{
140149
key += c;

0 commit comments

Comments
 (0)