*** The wcm.io Project is closing down this JIRA Instance in favor of GitHub issues. *** Please use the corresponding GitHub projects to report issues - or the mailing list for general discussion.

Issues

Select view

Select search mode

 

Escape.jcrLikeExpression()

Fixed

Description

Can we add:

for using user input in a JCR like query?

Details

Assignee

Reporter

Components

Priority

Created March 22, 2022 at 10:32 AM
Updated April 27, 2022 at 9:44 AM
Resolved April 27, 2022 at 9:44 AM

Activity

Show:

Stefan SeifertApril 27, 2022 at 9:44 AM

it's merged - thanks for the contribution!

Henry KuijpersApril 13, 2022 at 9:38 AM

Hi Stefan,

I’m sorry for the late response, but I just created a PR here: https://github.com/wcm-io/io.wcm.sling.commons/pull/3

Let me know what you think of it.

Stefan SeifertMarch 23, 2022 at 8:44 AM

and also add a reference to

Stefan SeifertMarch 23, 2022 at 8:44 AM

understood. a sligthly more consistent name probably would be jcrQueryLikeString, also to differntate from jcrQueryContainsExpr which does “more” like adding quote.

can you can up with a PR including unit tests?

Henry KuijpersMarch 22, 2022 at 8:17 PM

I think that method is doing a bit too much? The method in the description of this ticket is doing only the escaping that is required for a like expression.

I’m not entirely sure if jcrQueryContainsExpr achieves the same result though. It definitely doesn't escape % and _, which would be required. It also quotes the string that is returned, which is not desired, as there might be % /_ added by the developer since that should be part of the query (just not the parts that are user input).

Loading...