fix(osm): default an absent /api/osm/features limit to 500

Without a limit parameter the route read null, Number(null) is 0, and the
clamp turned that into a one-feature list. An absent or empty limit now
gets the documented default of 500.
This commit is contained in:
Sameh Khamis committed 2026-11-03 09:13:40 -08:00
1 parent 68667e2e3c
commit 3d2896cf27
2 files changed
+29 -1

No files matched your search

+7 -1
View File
@@ -109,7 +109,13 @@ export function compileOsmFeatureQuery(request = {}) {
? 'That area is too large to search; narrow it down.'
: 'That area is too large to list; count first or narrow it down.',
);
const requested = Number(request.limit);
// An absent or empty limit is the default, not Number(null) = 0.
const requested =
request.limit === null ||
request.limit === undefined ||
String(request.limit).trim() === ''
? NaN
: Number(request.limit);
const limit = Math.max(
1,
Math.min(