esm7 / obsidian-map-view

Interactive map view for Obsidian.md
MIT License
546 stars 25 forks source link

Any URL parsing rule with invalid regex breaks all geocoding #249

Open jordanmills opened 3 weeks ago

jordanmills commented 3 weeks ago

There's no input or value validation on the URL parsing rules. Or on other URLs too, I guess, but this is where I found it.

In this case, it breaks the flyover and modal location suggestions though (for inline and frontmatter location command actions). They just don't come up, and there's no indication in the regular GUI to indicate the issue.

The debug log option will put a message like this in the console. I will leave my fat-fingered regex in for posterity.

Uncaught (in promise) SyntaxError: Invalid regular expression: /https:\/\/www.bing.com\/maps\/\?\S+cp=[0-9\.\-]+%7E[0-9\.\-]+)\S*/g: Unmatched ')'
    at RegExp (<anonymous>)
    at UrlConvertor.parseLocationFromUrl (plugin:obsidian-map-view:18159:28)
    at GeoSearcher.eval (plugin:obsidian-map-view:18282:61)
    at Generator.next (<anonymous>)
    at eval (plugin:obsidian-map-view:70:71)
    at new Promise (<anonymous>)
    at __awaiter (plugin:obsidian-map-view:66:12)
    at GeoSearcher.search (plugin:obsidian-map-view:18279:16)
    at LocationSearchDialog.eval (plugin:obsidian-map-view:35664:58)
    at Generator.next (<anonymous>)
esm7 commented 2 weeks ago

Will fix, thank you.