Twin-Cities-Mutual-Aid / twin-cities-aid-distribution-locations

A webapp to coordinate aid and care in the Twin Cities.
43 stars 32 forks source link

Duplicate URLs from cell render javascript code in map popups #234

Closed mc-funk closed 4 years ago

mc-funk commented 4 years ago

Issue

When the same url (or tel number or email address) is in a cell more than once, the second time it tries to replace the text with the code for the url it replaces it in the wrong spot because it re-replaces the first value that had already been replaced, causing javascript code to show up in the text on the map popup.

Screenshots

image image

The DOM looks like: <a href="mailto:<a href=" mailto:info@sourcemn.org"="" target="_blank" onclick="captureOutboundLink('mailto:info@sourcemn.org', 'seeking_volunteers_badge')">info@sourcemn.org</a>

Slack Thread

More info/detail/troubleshooting is available on https://tcmap.slack.com/archives/C014ZPBN2QL/p1598387857012400 -- seems there is an issue with the data itself, but preventing duplications could probably be handled programmatically.