Skip to content

Commit cd2d122

Browse files
authored
EDR: safeguard typing on z query parameter (geopython#2076)
* EDR: safeguard typing on z query parameter * fix ref
1 parent d596731 commit cd2d122

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pygeoapi/api/environmental_data_retrieval.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# =================================================================
2-
2+
#
33
# Authors: Tom Kralidis <tomkralidis@gmail.com>
44
# Francesco Bartoli <xbartolone@gmail.com>
55
# Sander Schaminee <sander.schaminee@geocat.net>
@@ -8,7 +8,7 @@
88
# Ricardo Garcia Silva <ricardo.garcia.silva@geobeyond.it>
99
# Bernhard Mallinger <bernhard.mallinger@eox.at>
1010
#
11-
# Copyright (c) 2024 Tom Kralidis
11+
# Copyright (c) 2025 Tom Kralidis
1212
# Copyright (c) 2025 Francesco Bartoli
1313
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
1414
# Copyright (c) 2023 Ricardo Garcia Silva
@@ -52,8 +52,8 @@
5252
from pygeoapi.provider.base import (
5353
ProviderGenericError, ProviderItemNotFoundError)
5454
from pygeoapi.util import (
55-
filter_providers_by_type, get_provider_by_type, render_j2_template,
56-
to_json, filter_dict_by_key_value
55+
filter_providers_by_type, get_provider_by_type, get_typed_value,
56+
render_j2_template, to_json, filter_dict_by_key_value
5757
)
5858

5959
from . import (APIRequest, API, F_COVERAGEJSON, F_HTML, F_JSON, F_JSONLD,
@@ -334,7 +334,10 @@ def get_collection_edr_query(api: API, request: APIRequest,
334334
within_units = request.params.get('within-units')
335335

336336
LOGGER.debug('Processing z parameter')
337-
z = request.params.get('z')
337+
try:
338+
z = get_typed_value(request.params.get('z'))
339+
except TypeError:
340+
z = None
338341

339342
if parameternames and not any((fld in parameternames)
340343
for fld in p.get_fields().keys()):

0 commit comments

Comments
 (0)