noi-techpark / it.bz.opendatahub.databrowser

Explore and navigate through Open Data you need to build your next service.
https://databrowser.opendatahub.com
GNU Affero General Public License v3.0
8 stars 7 forks source link

Wrong link on some Datasets where Filter contains a space #540

Closed RudiThoeni closed 3 months ago

RudiThoeni commented 3 months ago

I noticed if a dataset has a ApiFilter with a space (%20) inside the link is not working, no data is displayed the reason is a wrong link is produced (instead of %20 the link contains %2520) at example for

https://databrowser.opendatahub.com/dataset-overview/df20ab77-88a2-439f-8abb-2d46de147a42 produces https://databrowser.opendatahub.com/dataset/table/tourism/v1/ODHActivityPoi?tagfilter=running%2520fitness

or https://databrowser.opendatahub.com/dataset-overview/3d49fd59-1856-46c1-a3e4-b51e35e34630 link is https://databrowser.opendatahub.com/dataset/table/tourism/v1/ODHActivityPoi?tagfilter=nightlife%2520and%2520entertainment

gappc commented 3 months ago

@RudiThoeni I took a look at it, here is what I found

The problem seems to be related to the fact, that the link to the table view in e.g. https://databrowser.opendatahub.com/dataset-overview/df20ab77-88a2-439f-8abb-2d46de147a42 is rendered by vue-router (the routing system in use) and that the query part of the link defined in the corresponding MetaData API entry contains an already encoded white space tagfilter=running%20fitness.

vue-router takes that value when it builds the link to the table view and escapes tagfilter=running%20fitness one more time, turning the % character into %25, the final query param now becomes tagfilter=running%2520fitness, which is obviously wrong. Unfortunately there is no way to prevent vue-router from doing so, except from decoding the query first, but that seems a bit strange.

I remember telling explicitly to encode the query params like done above. During the integration of the mobility API the way how table links are computed changed. I think the reason that it was working once and now it isn't is related to those changes. You can find the current related Data Browser code here and here

While investigating the issue, I found another entry in the MetaData API for the echarging-stations, which does not encode the white spaces in the query part (see corresponding MetaData entry and dataset-overview page). Not encoding the query white spaces seems to fix the issue, because vue-router encodes the white space on its own. Could you please try if that works for you? tagfilter=running%20fitness would then become tagfilter=running fitness

PS: I'm no more able to save changes to the MetaData API on the TEST environment (https://databrowser.opendatahub.testingmachine.eu/) and local DEV environment, I always get a "403 - Forbidden" response from ODH, so it was a bit hard to check stuff. Would it be possible to get the permission on TEST again? ;)

RudiThoeni commented 3 months ago

@gappc thx you are right, The problem occurs when the white spaces are encoded, i tried now to insert via databrowser a normal space and i saw the whit spaces are not encoded. I think when customer care inserted the data for metadata they copied the encoded strings. I will now correct this entrys and we are done, issue closed

RudiThoeni commented 3 months ago

@gappc i readded the permissions of metadata modify to test@databrowser.noi.bz.it

gappc commented 3 months ago

@RudiThoeni the permissions work, thx :+1: