fix: filter protocols on open

pull/6773/head^2
Konstantinos Kaloutas 2022-10-07 13:36:14 +03:00 committed by Andelf
parent d238c88afd
commit 81a6d23c4d
1 changed files with 5 additions and 3 deletions

View File

@ -112,9 +112,11 @@
[url default-open]
(let [URL (.-URL URL)
parsed-url (try (URL. url) (catch :default _ nil))]
(if (and parsed-url (contains? #{"https:" "http:" "mailto:"} (.-protocol parsed-url)))
(.openExternal shell url)
(when default-open (default-open url)))))
(when parsed-url
(condp contains? (.-protocol parsed-url)
#{"https:" "http:" "mailto:"} (.openExternal shell url)
#{"file:"} (default-open url)
nil))))
(defn setup-window-listeners!
[^js win]