Matthias Schur created OLINGO-1571:
--------------------------------------
Summary: $search does not allow some special characters in search
phrase
Key: OLINGO-1571
URL: https://issues.apache.org/jira/browse/OLINGO-1571
Project: Olingo
Issue Type: Bug
Components: odata4-server
Affects Versions: (Java) V4 4.9.0
Reporter: Matthias Schur
OLINGO 4 $search requires double encoding of some chars in search phrases.
The [OData
ABNF|[https://github.com/oasis-tcs/odata-abnf/blob/99d6836d59f51fdd75cc9484bea3f537a098015f/abnf/odata-abnf-construction-rules.txt#L350]]
requires certain special chars such as *&* to be percent-encoded in search
phrases:
{code:java}
searchPhrase = quotation-mark 1*( qchar-no-AMP-DQUOTE / SP ) quotation-mark
qchar-no-AMP-DQUOTE = unreserved / pct-encoded-no-DQUOTE / other-delims / ":" /
"@" / "/" / "?" / "$" / "'" / "="{code}
However, Olingo
[decodes|[https://github.com/apache/olingo-odata4/blob/4.9.0/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java#L103]]
search options before parsing, e.g. the search phrase *"bike %26 car"* is
encoded to *%22bike%20%26%20car%22* and ** decoded to *"bike & car"* before
parsing the search phrase. This results in an exception *'Forbidden character
in state PHRASE->&’.*
Workaround: Double encode special characters in search phrases.
{code:java}
http://host/service/Products?$search="bike %2526 car" {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)