fix: cannot download file from all-files page

pull/2093/head
Weihua Lu 2021-06-03 00:26:51 +08:00 committed by Tienson Qin
parent 0ee03f3b31
commit 230e3c49de
1 changed files with 16 additions and 7 deletions

View File

@ -35,13 +35,22 @@
(defn- get-file-content
[file-path]
(let [page-name
(ffirst (d/q '[:find ?pn
:where
[?e :file/path file-path]
[?p :block/file ?e]
[?p :block/name ?pn]] (db/get-conn)))]
(get-page-content page-name)))
(if-let [page-name
(ffirst (d/q '[:find ?pn
:in $ ?path
:where
[?p :block/file ?f]
[?p :block/name ?pn]
[?f :file/path ?path]]
(db/get-conn) file-path))]
(get-page-content page-name)
(ffirst
(d/q '[:find ?content
:in $ ?path
:where
[?f :file/path ?path]
[?f :file/content ?content]]
(db/get-conn) file-path))))
(defn- get-blocks-contents
[repo root-block-uuid]