Skip to content

Commit

Permalink
Merge pull request #19137 from rpastrana/HPCC-32699-ALA-Encode
Browse files Browse the repository at this point in the history
HPCC-32699 Encode all ALA response data

Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Sep 25, 2024
2 parents ce9b821 + 006814c commit b211000
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,18 @@ unsigned AzureLogAnalyticsCurlClient::processHitsJsonResp(IPropertyTreeIterator
ForEach(*fields)
{
const char * fieldName = header.item(idx++);
returnbuf.appendf("<%s>%s</%s>", fieldName, fields->query().queryProp("."), fieldName);
const char * rawValue = fields->query().queryProp(".");

if (isEmptyString(rawValue))
{
returnbuf.appendf("<%s/>", fieldName);
}
else
{
StringBuffer encodedValue;
encodeXML(rawValue, encodedValue);
returnbuf.appendf("<%s>%s</%s>", fieldName, encodedValue.str(), fieldName);
}
}
returnbuf.append("</line>");
recsProcessed++;
Expand Down Expand Up @@ -976,7 +987,10 @@ unsigned AzureLogAnalyticsCurlClient::processHitsJsonResp(IPropertyTreeIterator
if (!firstField)
hitchildjson.append(", ");

hitchildjson.appendf("\"%s\":\"%s\"", header.item(idx++), fields->query().queryProp("."));
StringBuffer encodedValue;
encodeJSON(encodedValue, fields->query().queryProp("."));

hitchildjson.appendf("\"%s\":\"%s\"", header.item(idx++), encodedValue.str());

firstField = false;
}
Expand Down Expand Up @@ -1020,7 +1034,7 @@ unsigned AzureLogAnalyticsCurlClient::processHitsJsonResp(IPropertyTreeIterator
else
first = false;

fieldElementsItr->query().getProp(nullptr, returnbuf); // commas in data should be escaped
encodeCSVColumn(returnbuf, fieldElementsItr->query().queryProp("."));
}
returnbuf.newline();
recsProcessed++;
Expand Down

0 comments on commit b211000

Please sign in to comment.