Skip to content

Commit c464c6c

Browse files
committed
Fix codescan bugs
1 parent 356ff96 commit c464c6c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ MapboxEventManager.prototype = {
272272
*/
273273
shouldEnableLogging: function(options){
274274
if (options.enableEventLogging === false) return false;
275-
if (options.origin && options.origin.indexOf('api.mapbox.com') == -1) return false;
275+
if (options.origin && options.origin !== 'https://api.mapbox.com') return false;
276276
// hard to make sense of events when a local instance is suplementing results from origin
277277
if (options.localGeocoder) return false;
278278
// hard to make sense of events when a custom filter is in use

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ MapboxGeocoder.prototype = {
569569

570570
_requestType: function(options, search) {
571571
var type;
572-
const reverseGeocodeCoordRgx = /^[ ]*(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/;
572+
const reverseGeocodeCoordRgx = /^[ ]*(-?\d{1,3}\.?\d{0,16})[, ]+(-?\d{1,3}\.?\d{0,16})[ ]*$/;
573573
if (options.localGeocoderOnly) {
574574
type = GEOCODE_REQUEST_TYPE.LOCAL;
575575
} else if (options.reverseGeocode && reverseGeocodeCoordRgx.test(search)) {
@@ -649,7 +649,7 @@ MapboxGeocoder.prototype = {
649649
case GEOCODE_REQUEST_TYPE.FORWARD: {
650650
// Ensure that any reverse geocoding looking request is cleaned up
651651
// to be processed as only a forward geocoding request by the server.
652-
const reverseGeocodeCoordRgx = /^[ ]*(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)*[ ]*$/;
652+
const reverseGeocodeCoordRgx = /^[ ]*(-?\d{1,3}\.?\d{0,16})[, ]+(-?\d{1,3}\.?\d{0,16})*[ ]*$/;
653653
if (reverseGeocodeCoordRgx.test(search)) {
654654
search = search.replace(/,/g, ' ');
655655
}

0 commit comments

Comments
 (0)