SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.96k stars 1.24k forks source link

sap.m.FacetFilterList: search functionality generates invalid OData request (search value not quoted) #2145

Closed rpbouman closed 6 years ago

rpbouman commented 6 years ago

https://github.com/SAP/openui5/blob/c0721998a99036f33cc83672c7d842647000163b/src/sap.m/src/sap/m/FacetFilterList.js#L589

My Application uses sap.m.FacetFilterList on a OData model. I have a factory method that createa my FacetFilterList on a String type field and I set the dataType property of the list to FacetFilterListDataType.String

Problem occurs when searching the list. The Control generates OData requests like this:

http://localhost:8443/snowdata/GDELT_EVENTS?$skip=0&$top=20&$filter=(substringof(ma,VALUE))

.VALUE is the property the facet is bound to. 'ma' is what is entered into the search input. This ends up unquoted in the OData url. That is wrong: it should have been a single quoted string literal.

Strange thing is that the code does seem provide explicit quoting in case enableCaseInsensitiveSearch is true. This is strange - I think the OData spec always requires quoting of string literals.

rpbouman commented 6 years ago

I can verify that creating the FacetFilterList with property enableCaseInsensitiveSearch set to true now generates valid string literals. This does not solve my issue though: I want valid string literals to be generated always independent of whether searching is case sensitive.

a-z-ivanov commented 6 years ago

Hi, The issue is now tracked internally 1880493053. You will be updated on the status.

Regards, Alex

a-z-ivanov commented 6 years ago

Could you share your example, please? My tests show query fragments like this:

$filter=substringof(%27cha%27,tolower(ProductName)) and $filter=substringof(%27cha%27,ProductName) which is without enableCaseInsensitiveSearch

They are properly encoded search terms. Which version of ui5 do you use?

rpbouman commented 6 years ago

I’m using cdn latest. If you debug your version, wich codepath does it take? I marked the conditional in the code.

Sent from my iPhone

On 14 Aug 2018, at 08:54, a-z-ivanov notifications@github.com wrote:

Could you share your example, please? My tests show query fragments like this:

$filter=substringof(%27cha%27,tolower(ProductName)) and $filter=substringof(%27cha%27,ProductName) which is without enableCaseInsensitiveSearch

They are properly encoded search terms. Which version of ui5 do you use?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

a-z-ivanov commented 6 years ago

Checked with this one: https://openui5.hana.ondemand.com/resources/sap-ui-core.js Its version is currently 1.56.6 (in the Chrome's dev tools console, type sap.ui.version).

With the two examples (enableCaseInsensitiveSearch: true/false) it goes once inside the marked if, and once outside. Whether the value is surrounded by quotes or not, I always get the list filtered. And the network request is always properly encoded ($filter=substringof(%27cha%27, ... ), there is %27 char surrounding the search term).