Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Characters escape when paginating search #12

Open
lhcorralo opened this issue Mar 3, 2023 · 1 comment
Open

Characters escape when paginating search #12

lhcorralo opened this issue Mar 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@lhcorralo
Copy link

I have an internal server and I am executing a search request, with the following URL

http://localhost:5252/search?collections=sentinel-2-l1c&intersects={%22type%22:%22MultiPolygon%22,%22coordinates%22:[[[[-0.99999991,40.00000005],[8.38190317E-8,40.00000005],[8.38190317E-8,39.00000005],[-0.99999991,39.00000005],[-0.99999991,40.00000005]]]],%22crs%22:{%22type%22:%22name%22,%22properties%22:{%22name%22:%22EPSG:0%22}}}&datetime=2022-08-01T00:00:00Z/2022-08-31T23:59:59.999999999Z

The search returns paginated requests. The "links" field is:

"links": [
    {
        "rel": "next",
        "type": "application/geo+json",
        "method": "GET",
        "href": "[http://localhost:5252/search?collections=sentinel-2-l1c&intersects={\"type\":\"MultiPolygon\",\"coordinates\":[[[[-0.99999991,40.00000005],[8.38190317E-8,40.00000005],[8.38190317E-8,39.00000005],[-0.99999991,39.00000005],[-0.99999991,40.00000005]]]],\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:0\"}}}&datetime=2022-08-01T00:00:00Z/2022-08-31T23:59:59.999999999Z&token=next:58f1d6c4-8d35-3227-b86a-dcc6a3500e38](http://localhost:5252/search?collections=sentinel-2-l1c&intersects={%22type%22:%22MultiPolygon%22,%22coordinates%22:[[[[-0.99999991,40.00000005],[8.38190317E-8,40.00000005],[8.38190317E-8,39.00000005],[-0.99999991,39.00000005],[-0.99999991,40.00000005]]]],%22crs%22:{%22type%22:%22name%22,%22properties%22:{%22name%22:%22EPSG:0%22}}}&datetime=2022-08-01T00:00:00Z/2022-08-31T23:59:59.999999999Z&token=next:58f1d6c4-8d35-3227-b86a-dcc6a3500e38)"
    },
    {
        "rel": "root",
        "type": "application/json",
        "href": "http://localhost:5252/"
    },
    {
        "rel": "self",
        "type": "application/json",
        "href": "http://localhost:5252/search?collections=sentinel-2-l1c&intersects={%22type%22:%22MultiPolygon%22,%22coordinates%22:[[[[-0.99999991,40.00000005],[8.38190317E-8,40.00000005],[8.38190317E-8,39.00000005],[-0.99999991,39.00000005],[-0.99999991,40.00000005]]]],%22crs%22:{%22type%22:%22name%22,%22properties%22:{%22name%22:%22EPSG:0%22}}}&datetime=2022-08-01T00:00:00Z/2022-08-31T23:59:59.999999999Z"
    }
]

It can be seen that link "self" escape different characters than link "next" and "previous". In particular, "self" escapes the double quotes.

In addition, characters [ and ] are reserved according to https://developers.google.com/maps/url-encoding?hl=en, and they are not escaped in any case (I have doubts about if characters { and } should be escaped, despite seeming a good idea).

Thanks!

@gadomski gadomski added the bug Something isn't working label Mar 3, 2023
@gadomski gadomski self-assigned this Mar 3, 2023
@gadomski gadomski removed their assignment Jun 12, 2023
@StijnCaerts
Copy link

There was a similar issue in stac-fastapi-elasticsearch-opensearch (stac-utils/stac-fastapi-elasticsearch-opensearch#215). It was solved by removing the unquote() call on the parameter string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants