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

Support EDR single item locations for Starlette #1827

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

webb-ben
Copy link
Member

@webb-ben webb-ben commented Oct 8, 2024

Overview

Starlette improperly parses the request path when parsing EDR queries for locations/{location_id}, this PR fixes that behavior to correctly identify when there is a single location specified.

Related Issue / discussion

Additional information

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

@@ -528,9 +528,15 @@ async def get_collection_edr_query(request: Request, collection_id=None, instanc
instance_id = request.path_params['instance_id']

query_type = request["path"].split('/')[-1] # noqa
location_id = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest:

    if 'collection_id' in request.path_params:
        collection_id = request.path_params['collection_id']

    if 'instance_id' in request.path_params:
        instance_id = request.path_params['instance_id']

    if 'location_id' in request.path_paths:
        location_id = request.path_params['location_id']

    query_type = request["path"].split('/')[-1]

    return await execute_from_starlette(
        edr_api.get_collection_edr_query, request, collection_id,
        instance_id, location_id, query_type,
        skip_valid_check=True
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants