Skip to content

Commit

Permalink
Use JSON.stringify to escape value for mysql when GET assets called w…
Browse files Browse the repository at this point in the history
…ith metadata key:value filter (#1437)
  • Loading branch information
cd-rite authored Nov 19, 2024
1 parent 5a203f6 commit b7d3598
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/source/service/AssetService.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ exports.queryAssets = async function (inProjection = [], inPredicates = {}, elev
for (const pair of inPredicates.metadata) {
const [key, value] = pair.split(/:(.*)/s)
predicates.statements.push('JSON_CONTAINS(a.metadata, ?, ?)')
predicates.binds.push( `"${value}"`, `$.${key}`)
predicates.binds.push( JSON.stringify(value), `$.${key}`)
}
}
predicates.statements.push('cg.userId = ?')
Expand Down

0 comments on commit b7d3598

Please sign in to comment.