fix redundant relative path when inserting orgmode page reference

occurs when creating a new page in autocomplete menu if
`org-mode/insert-file-link` non-nils.

fix https://github.com/logseq/logseq/issues/4732
pull/4802/head
llcc 2022-04-01 23:18:48 +08:00 committed by Tienson Qin
parent 93b49b59d5
commit a1293513ec
1 changed files with 11 additions and 4 deletions

View File

@ -577,10 +577,17 @@
(util/get-relative-path edit-block-file-path ref-file-path)
page)
(let [journal? (date/valid-journal-title? page)
ref-file-path (str (get-directory journal?)
"/"
(get-file-name journal? page)
".org")]
ref-file-path (str
(if (or (util/electron?) (mobile-util/is-native-platform?))
(-> (config/get-repo-dir (state/get-current-repo))
js/decodeURI
(string/replace #"/+$" "")
(str "/"))
"")
(get-directory journal?)
"/"
(get-file-name journal? page)
".org")]
(create! page {:redirect? false})
(util/format "[[file:%s][%s]]"
(util/get-relative-path edit-block-file-path ref-file-path)