From 3c33b98f8a913880b39389af3a5094d65ad10359 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Sat, 13 Oct 2018 09:57:09 -0400 Subject: [PATCH] chore(geo_common): only set bbox coords if it validates --- sanitizer/_geo_common.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sanitizer/_geo_common.js b/sanitizer/_geo_common.js index a3b15865..bec5839f 100644 --- a/sanitizer/_geo_common.js +++ b/sanitizer/_geo_common.js @@ -34,12 +34,6 @@ function sanitize_rect( key_prefix, clean, raw, bbox_is_required ) { // and not present if (!bbox_present) { return; } - // check each property individually. now that it is known a bbox is present, - // all properties must exist, so pass the true flag for coord_is_required - properties.forEach(function(prop) { - sanitize_coord(prop, clean, raw, true); - }); - var min_lat = parseFloat( raw[key_prefix + '.' + 'min_lat'] ); var max_lat = parseFloat( raw[key_prefix + '.' + 'max_lat'] ); if (min_lat > max_lat) { @@ -51,6 +45,11 @@ function sanitize_rect( key_prefix, clean, raw, bbox_is_required ) { if (min_lon > max_lon) { throw new Error( util.format( 'min_lon is larger than max_lon in \'%s\'', key_prefix ) ); } + + // use sanitize_coord to set values in `clean` + properties.forEach(function(prop) { + sanitize_coord(prop, clean, raw, true); + }); } /**