X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/371a780ef427d1b905a729da5f289b5e1099c152..08dcd05d7bc09ad4e70ff47ff6f393a1b91ad21a:/nominatim/api/v1/server_glue.py?ds=inline diff --git a/nominatim/api/v1/server_glue.py b/nominatim/api/v1/server_glue.py index fd4fa14b..865e1331 100644 --- a/nominatim/api/v1/server_glue.py +++ b/nominatim/api/v1/server_glue.py @@ -185,7 +185,7 @@ class ASGIAdaptor(abc.ABC): """ Return the accepted languages. """ return self.get('accept-language')\ - or self.get_header('http_accept_language')\ + or self.get_header('accept-language')\ or self.config().DEFAULT_LANGUAGE @@ -370,6 +370,9 @@ async def lookup_endpoint(api: napi.NominatimAPIAsync, params: ASGIAdaptor) -> A if len(oid) > 1 and oid[0] in 'RNWrnw' and oid[1:].isdigit(): places.append(napi.OsmID(oid[0], int(oid[1:]))) + if len(places) > params.config().get_int('LOOKUP_MAX_COUNT'): + params.raise_error('Too many object IDs.') + if places: results = await api.lookup(places, **details) else: @@ -439,6 +442,8 @@ async def search_endpoint(api: napi.NominatimAPIAsync, params: ASGIAdaptor) -> A details['min_rank'], details['max_rank'] = \ helpers.feature_type_to_rank(params.get('featureType', '')) + if params.get('featureType', None) is not None: + details['layers'] = napi.DataLayer.ADDRESS query = params.get('q', None) queryparts = {}