mapbox / mapbox/leaflet-image

Cannot read property 'match' of undefined

Open
#129 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
380
Forks
140
PR merge metrics
No merged PRs in 30d

Description

It occurs in this function,
function isDataURL(url) {
var dataURLRegex = /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i;
return !!url.match(dataURLRegex);
}

I am passing it like this,
leafletImage(map.leafletElement, fn(err, canvas){
});
map is a react leaflet map

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the isDataURL function shown in the report and trace the leafletImage(map.leafletElement, ...) call in the React Leaflet integration to find where url becomes undefined. Reproduce the error with the reported usage, then verify that the data-URL check handles the relevant input without throwing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.