You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Daniel Stieglitz (Jira)" <ji...@apache.org> on 2022/11/02 19:37:00 UTC

[jira] [Updated] (NIFI-10754) Nifi Expression Language method urlEncode does encode a URL path correctly when it contains white space

     [ https://issues.apache.org/jira/browse/NIFI-10754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Stieglitz updated NIFI-10754:
------------------------------------
    Description: 
The Nifi Expression Language urlEncode method replaces white space with a + and not %20. That is fine for the query section of a URL but not the path. There are many Stackoverflow posts which detail the issue. Here is one, [URLEncoder not able to translate space character|https://stackoverflow.com/questions/4737841/urlencoder-not-able-to-translate-space-character]

Our particular scenario is where we build a URL from attributes and then try to call the URL with InvokeHTTP

e.g. of a URL with a space in its path
{code:java}
https://somehost/api/v1/somepath /actual?att1=something&att2=somethingelse{code}
 

urlEncode will convert that url to 
{code:java}
https%3A%2F%2Fsomehost%2Fapi%2Fv1%2Fsomepath+%2Factual%3Fatt1%3Dsomething%26att2%3Dsomethingelse{code}
The + in the URL path is not the same as a blank space hence the call to InvokeHttp fails.

  was:
The Nifi Expression Language urlEncode method replaces white space with a + and not %20. That is fine for the query section of a URL but not the path. There are many Stackoverflow posts which detail the issue. Here is one, [URLEncoder not able to translate space character|https://stackoverflow.com/questions/4737841/urlencoder-not-able-to-translate-space-character]

Our particular scenario is where we build a URL from attributes and then try to call the URL with InvokeHTTP

e.g. of a URL with a space in its path
{code:java}
https://somehost/api/v1/somepath /actual?att1=something&att2=somethingelse{code}
 

Using urlEncode will convert that url to 
{code:java}
https%3A%2F%2Fsomehost%2Fapi%2Fv1%2Fsomepath+%2Factual%3Fatt1%3Dsomething%26att2%3Dsomethingelse{code}
The + in the URL path is not the same as a blank space hence the call to InvokeHttp fails.


> Nifi Expression Language method urlEncode does encode a URL path correctly when it contains white space
> -------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-10754
>                 URL: https://issues.apache.org/jira/browse/NIFI-10754
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Daniel Stieglitz
>            Priority: Major
>
> The Nifi Expression Language urlEncode method replaces white space with a + and not %20. That is fine for the query section of a URL but not the path. There are many Stackoverflow posts which detail the issue. Here is one, [URLEncoder not able to translate space character|https://stackoverflow.com/questions/4737841/urlencoder-not-able-to-translate-space-character]
> Our particular scenario is where we build a URL from attributes and then try to call the URL with InvokeHTTP
> e.g. of a URL with a space in its path
> {code:java}
> https://somehost/api/v1/somepath /actual?att1=something&att2=somethingelse{code}
>  
> urlEncode will convert that url to 
> {code:java}
> https%3A%2F%2Fsomehost%2Fapi%2Fv1%2Fsomepath+%2Factual%3Fatt1%3Dsomething%26att2%3Dsomethingelse{code}
> The + in the URL path is not the same as a blank space hence the call to InvokeHttp fails.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)