SEARCH-2071 Escaping JSON strings for Authorities and Property values. (#517)

Using Freemarker "json_string" function instead of ad-hoc code, as it's provided by default from 2.3.1 version
This commit is contained in:
Angel Borroy
2020-01-27 15:13:56 +01:00
committed by GitHub
parent f5e0cac1fa
commit 2132bb1280

View File

@@ -1,6 +1,3 @@
<#macro json_string string>${string?js_string?replace("\\'", "\'")?replace("\\>", ">")}</#macro>
<#macro aclChangeSetJSON aclChangeSet> <#macro aclChangeSetJSON aclChangeSet>
{ {
"id": ${aclChangeSet.id?c}, "id": ${aclChangeSet.id?c},
@@ -24,14 +21,14 @@
"readers" : "readers" :
[ [
<#list aclReaders.readers as reader> <#list aclReaders.readers as reader>
"${reader?string}" "${reader?json_string}"
<#if reader_has_next>,</#if> <#if reader_has_next>,</#if>
</#list> </#list>
], ],
"denied" : "denied" :
[ [
<#list aclReaders.denied as denied> <#list aclReaders.denied as denied>
"${denied?string}" "${denied?json_string}"
<#if denied_has_next>,</#if> <#if denied_has_next>,</#if>
</#list> </#list>
] ]
@@ -54,7 +51,7 @@
"txnId": ${node.txnId?c}, "txnId": ${node.txnId?c},
"status": "<#if node.deleted>d<#else>u</#if>", "status": "<#if node.deleted>d<#else>u</#if>",
<#if node.aclId??>"aclId": ${node.aclId?c},</#if> <#if node.aclId??>"aclId": ${node.aclId?c},</#if>
<#if node.shardPropertyValue??>"shardPropertyValue": "${node.shardPropertyValue?string}",</#if> <#if node.shardPropertyValue??>"shardPropertyValue": "${node.shardPropertyValue?json_string}",</#if>
<#if node.explicitShardId??>"explicitShardId": "${node.explicitShardId?c}",</#if> <#if node.explicitShardId??>"explicitShardId": "${node.explicitShardId?c}",</#if>
"tenant": "${node.tenant}" "tenant": "${node.tenant}"
} }
@@ -151,7 +148,7 @@
</#if> </#if>
<#if filter.includeOwner??> <#if filter.includeOwner??>
<#if nodeMetaData.owner??> <#if nodeMetaData.owner??>
, "owner": "${nodeMetaData.owner}" , "owner": "${nodeMetaData.owner?json_string}"
</#if> </#if>
</#if> </#if>
} }