← Back to team overview

dhis2-devs team mailing list archive

Re: Use of square brackets [] in metadata field filter

 

Thanks guys.

@Lars - (This is v2.27) On the Reports page, if you go to Data Approvals
(i.e. dhis-web-reporting/showDataApprovalForm.action), I see a request to
the following URL:
api/dataSets.json?fields=id,displayName,periodType,workflow,categoryCombo[id,displayName]&paging=false

Cheers,

- Jasper

On Wed, Oct 31, 2018 at 9:42 AM Lars Helge Øverland <lars@xxxxxxxxx> wrote:

> Hi there,
>
> Vlad is right on the above.
>
> Longer term we will work on replacing the use of square brackets with a
> URL safe character (there are not many left) and/or perhaps a
> POST-with-JSON-payload based solution.
>
> In the short term we will ensure all web API requests are encoded.
>
> As Vlad say, the best option short term is to use *r*
> *elaxedQueryChars="[]"* at the Tomcat HTTP connector level.
>
> *Jasper:* Are you able to tell us in which apps and which requests had
> those unencoded requests?
>
> best,
>
> Lars
>
>
>
> On Tue, 30 Oct 2018 at 12:25, Vladimer Shioshvili <vshioshvili@xxxxxxxxx>
> wrote:
>
>> We faced the same issue, and I have brought it to Lars' attention, and he
>> is aware of the issue. According to him, DHIS2 will be addressing this by
>> changing square brackets in the long term, but in the short term solution
>> you can make square brackets be exempted on the tomcat side by using
>> relaxedQueryChars="[]" in the Tomcat connector configuration.
>>
>>
>> On Tue, Oct 30, 2018 at 6:57 AM Jasper Timm <
>> jasper.timm@xxxxxxxxxxxxxxxxx> wrote:
>>
>>> Hi DHIS2 devs,
>>>
>>> I faced an issue recently with using (unencoded) square brackets in
>>> requests to the DHIS2 API. It turns out it was related to a new version of
>>> tomcat (7.0.90). I've spoken to the tomcat devs and they've said that they
>>> will now consider unencoded square brackets in a request to be an error.
>>>
>>> According to the docs:
>>> https://docs.dhis2.org/master/en/developer/html/webapi_metadata_field_filter.html square
>>> brackets are used to indicate a subfield, when using the field query
>>> parameter.
>>>
>>> Might it be worth considering changing the symbol used for this? At the
>>> very least it should be made clear that the requests using it will need to
>>> be URL encoded.
>>>
>>> There are even requests in the DHIS2 frontend (I'm running v2.27) which
>>> have unencoded square brackets. The approvals page in the report view fails
>>> with the new version of tomcat for this reason. It would be worth ensuring
>>> all frontend requests are properly encoded.
>>>
>>> Cheers,
>>>
>>> - Jasper
>>> --
>>>
>>> Jasper Timm
>>>
>>> Lead Software Developer
>>>
>>> <http://www.ehealthafrica.org/>
>>>
>>> eHealth Africa
>>> 4A Renner Drive
>>> Off Wilkinson Road (behind Monoprix Supermarket)
>>> Freetown, Sierra Leone
>>>
>>> mobile +232 99891119 <+232%2099%20891119>
>>>
>>> --
>>>
>>> <https://web.facebook.com/EHealthAfrica>
>>> <https://twitter.com/eHealth_africa>
>>> <https://www.linkedin.com/company/1449060/>
>>> <https://www.instagram.com/ehealthafrica/>
>>> <https://www.youtube.com/channel/UCcgM_HhTcg5M9Ji3Of6QmUg>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
> --
>
>
> Lars Helge Øverland
> Technical lead, DHIS 2
> University of Oslo
> lars@xxxxxxxxx
> https://www.dhis2.org
>
> --

Jasper Timm

Lead Software Developer

<http://www.ehealthafrica.org/>

eHealth Africa
4A Renner Drive
Off Wilkinson Road (behind Monoprix Supermarket)
Freetown, Sierra Leone

mobile +232 99891119

--

<https://web.facebook.com/EHealthAfrica>
<https://twitter.com/eHealth_africa>
<https://www.linkedin.com/company/1449060/>
<https://www.instagram.com/ehealthafrica/>
<https://www.youtube.com/channel/UCcgM_HhTcg5M9Ji3Of6QmUg>

References