fix: don't treat file link as pages

Resolved #1334
This commit is contained in:
Tienson Qin
2021-02-21 17:31:53 +08:00
parent c1e7b4e5a5
commit 88d1fa8b91

View File

@@ -36,10 +36,12 @@
(= typ "Search")
;; FIXME: alert error
(not (contains? #{\# \* \/ \[} (first (second (:url (second block))))))
(let [page (second (:url (second block)))]
(when (and (not (util/starts-with? page "http"))
(not (util/starts-with? page "file"))
(not (string/ends-with? page ".html")))
(let [page (second (:url (second block)))
ext (some-> (util/get-file-ext page) keyword)]
(when (and (not (util/starts-with? page "http:"))
(not (util/starts-with? page "https:"))
(not (util/starts-with? page "file:"))
(not (contains? (config/supported-formats) ext)))
page)))
(and