pelias / placeholder

stand-alone coarse geocoder
https://placeholder.demo.geocode.earth
MIT License
313 stars 35 forks source link

Internal Server Error when geocoding addresses containing `constructor` #231

Closed Joshua-Zou closed 2 months ago

Joshua-Zou commented 3 months ago

Describe the bug

When geocoding text that contains the word constructor, Pelias throws a http status 500, Internal Server Error.

Steps to Reproduce

  1. Start the Pelias Placeholder server
  2. GET /parser/search?text=constructor

Pelias returns an error described below.

Expected behavior Pelias does not have an internal server error.

Environment

Pelias Error

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>TypeError: Cannot read property &#39;length&#39; of undefined<br> &nbsp; &nbsp;at _isArrayRangeIsEqual (/code/pelias/placeholder/prototype/tokenize.js:68:32)<br> &nbsp; &nbsp;at _groups (/code/pelias/placeholder/prototype/tokenize.js:113:12)<br> &nbsp; &nbsp;at /code/pelias/placeholder/prototype/tokenize.js:34:22<br> &nbsp; &nbsp;at /code/pelias/placeholder/node_modules/async/dist/async.js:2960:13<br> &nbsp; &nbsp;at wrapper (/code/pelias/placeholder/node_modules/async/dist/async.js:271:20)<br> &nbsp; &nbsp;at replenish (/code/pelias/placeholder/node_modules/async/dist/async.js:441:29)<br> &nbsp; &nbsp;at /code/pelias/placeholder/node_modules/async/dist/async.js:451:13<br> &nbsp; &nbsp;at eachOfLimit$1 (/code/pelias/placeholder/node_modules/async/dist/async.js:477:34)<br> &nbsp; &nbsp;at awaitable (/code/pelias/placeholder/node_modules/async/dist/async.js:211:32)<br> &nbsp; &nbsp;at eachOfSeries (/code/pelias/placeholder/node_modules/async/dist/async.js:813:16)</pre>
</body>
</html>
missinglink commented 3 months ago

Thanks for the report, this is very odd.