Skip to content

Commit

Permalink
fix: metadata query param parsing (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
csmig authored Aug 30, 2024
1 parent aaa6708 commit 9919996
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/source/service/AssetService.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ exports.queryAssets = async function (inProjection = [], inPredicates = {}, elev
}
if ( inPredicates.metadata ) {
for (const pair of inPredicates.metadata) {
const [key, value] = pair.split(':')
const [key, value] = pair.split(/:(.*)/s)
predicates.statements.push('JSON_CONTAINS(a.metadata, ?, ?)')
predicates.binds.push( `"${value}"`, `$.${key}`)
}
Expand Down
2 changes: 1 addition & 1 deletion api/source/service/CollectionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ exports.queryCollections = async function (inProjection = [], inPredicates = {},
}
if ( inPredicates.metadata ) {
for (const pair of inPredicates.metadata) {
const [key, value] = pair.split(':')
const [key, value] = pair.split(/:(.*)/s)
predicates.statements.push('JSON_CONTAINS(c.metadata, ?, ?)')
predicates.binds.push( `"${value}"`, `$.${key}`)
}
Expand Down
2 changes: 1 addition & 1 deletion api/source/service/ReviewService.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ exports.getReviews = async function (inProjection = [], inPredicates = {}, userO
}
if ( inPredicates.metadata ) {
for (const pair of inPredicates.metadata) {
const [key, value] = pair.split(':')
const [key, value] = pair.split(/:(.*)/s)
predicates.statements.push('JSON_CONTAINS(r.metadata, ?, ?)')
predicates.binds.push( `"${value}"`, `$.${key}`)
}
Expand Down

0 comments on commit 9919996

Please sign in to comment.