Browse Source

more strictly enforce valid bbox content

pull/850/head
Stephen Hess 8 years ago
parent
commit
e5a5fe8f3f
  1. 9
      controller/placeholder.js

9
controller/placeholder.js

@ -7,13 +7,14 @@ const logging = require( '../helper/logging' );
const Document = require('pelias-model').Document; const Document = require('pelias-model').Document;
// returns true if all 4 ,-delimited (max) substrings are parseable as numbers // returns true if all 4 ,-delimited (max) substrings are parseable as numbers
// '12.12,21.21,13.13,31.31' returns true // '12.12,21.21,13.13,31.31' returns true
// '12.12,21.21,13.13,blah' returns false // '12.12,21.21,13.13,blah' returns false
// '12.12,21.21,13.13,31.31,blah' returns false
function validBoundingBox(bbox) { function validBoundingBox(bbox) {
return bbox. return bbox.
split(',', 4). split(',').
map(_.toNumber). map(_.toNumber).
every(_.isFinite); filter(_.isFinite).length === 4;
} }
function synthesizeDocs(result) { function synthesizeDocs(result) {

Loading…
Cancel
Save