[ 
https://issues.apache.org/jira/browse/OLINGO-1107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17071029#comment-17071029
 ] 

Technical Nishant commented on OLINGO-1107:
-------------------------------------------

Is the URL with '+' in case of sending Space handled in V2 also. We are on 
2.0.11 Olingo.

 

We are facing an issue with creating a filter expression for batch , where the 
batch request  contains a filter expression with space encoded as '+' . When we 
change this encoding to %20 the filter works. Meaning it can tokenize the 
operands and forma filter expression. 

 

Sample request With '+' Encoding

--Batch_1584556492344

Content-Type: application/http

Content-Transfer-Encoding: binary

 

GET 
TransfersCollection?$filter=((SelectedAccounts+eq+%27081699%27))&$format=json 
HTTP/1.1

 Response : 

-----------------------------------------------------------------

--batch_37a39045-879f-45a5-811e-fed5b48126c5

Content-Type: application/http

Content-Transfer-Encoding: binary

 

HTTP/1.1 400 Bad Request

DataServiceVersion: 1.0

Content-Type: application/json

Content-Length: 120

 

{"error":\{"code":null,"message":{"lang":"en","value":"Invalid filter 
expression: '((SelectedAccounts+eq+'081699'))'."}}}

--batch_37a39045-879f-45a5-811e-fed5b48126c5--

 

 

 

--Batch_1584556492344--

Sample request With '%20' Encoding

--Batch_1584556492344

Content-Type: application/http

Content-Transfer-Encoding: binary

 

GET 
TransfersCollection?$filter=((SelectedAccounts%20eq%20%27081699%27))&$format=json
 HTTP/1.1

 

 

--Batch_1584556492344--

 

 Response is 202 with valid json response.

 

 

 

> UriDecoder should use java.net.URLDecoder
> -----------------------------------------
>
>                 Key: OLINGO-1107
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1107
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-server
>    Affects Versions: (Java) V4 4.3.0
>            Reporter: Jon McEwen
>            Assignee: Ramesh Reddy
>            Priority: Major
>             Fix For: (Java) V4 4.4.0
>
>
> Query filters are incorrectly parsed, because the 
> org.apache.olingo.commons.core.Decoder doesn't convert '+' to space.
> Simple fix is to use java.net.URLDecoder instead (line 85):
> {{return URLDecoder.decode(encoded, "UTF-8");}}
> Additional unit test:
> {code:Java}
>   @Test
>   public void decodePlusAsSpace() throws Exception{
>         checkOption("%24filter=PaymentStatus+eq+%27Cleared%27", "$filter", 
> "PaymentStatus eq 'Cleared'");
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to