Trim url before opening in browser

This commit is contained in:
Roman Volosovskyi 2020-11-02 11:16:34 +02:00
parent 7402718e68
commit 27ad8f07c3
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 4 additions and 1 deletions

View File

@ -112,7 +112,10 @@
(.catch (or on-error #())))))
(defn normalize-url [url]
(str (when (and (string? url) (not (re-find #"^[a-zA-Z-_]+:/" url))) "https://") url))
(str (when (and (string? url)
(not (re-find #"^[a-zA-Z-_]+:/" url)))
"https://")
((fnil string/trim "") url)))
(def normalize-and-decode-url (comp js/decodeURI normalize-url))