-
Notifications
You must be signed in to change notification settings - Fork 9.4k

Description
Summary of the issue
When searching "like" results into products repository through REST API, values starting with % or %25 followed by some characters (e.g. "e" or "a") will give bad results, not as expected and described at "Logical OR search" section here: https://devdocs.magento.com/guides/v2.2/rest/performing-searches.html
Preconditions
Environment: LAMP (Apache 2.4.6, php 7.1.0)
Magento version: 2.2.5
Blank installation with 1 admin user, 1 Category and 1 Product (e.g. named "Educational")
Steps to reproduce
-
Call REST API to obtain admin token:
POST GET YOUR_BASE_URL /rest/V1/integration/admin/token
Parameters: username, password -
Call REST API to obtain products with the desired search criteria as follows:
GET YOUR_BASE_URL /rest/V1/products
?searchCriteria[filter_groups][0][filters][0][field]=name
&searchCriteria[filter_groups][0][filters][0][value]=%edu%
&searchCriteria[filter_groups][0][filters][0][condition_type]=like
OR
GET YOUR_BASE_URL /rest/V1/products
?searchCriteria[filter_groups][0][filters][0][field]=name
&searchCriteria[filter_groups][0][filters][0][value]=%25edu%25
&searchCriteria[filter_groups][0][filters][0][condition_type]=like
Where "edu" is the desired string.
It's the same with any "e" string + anything else, like "extreme" or "environment".
It seems to happen with many other characters (e.g. "%a" char combination)
Expected result
- Would expect % to be accepted or %25 to be encoded to % (as per https://devdocs.magento.com/guides/v2.2/rest/performing-searches.html, "Logical OR" section).
- Would expect to receive correct results with like search before and after the "edu" string.
Actual result
- It seems that the combination of "e" character after % and even after %25 is not encoded / decoded correctly.
- In case you put %e it will return filter_group > filters > value as "?u%", no items.
- In case you put %25e it will return a 200 OK response without any object, no items.
See attachments.