Browse Source

fix: filter protocols on open

Konstantinos Kaloutas 3 years ago
parent
commit
81a6d23c4d
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/electron/electron/window.cljs

+ 5 - 3
src/electron/electron/window.cljs

@@ -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]