mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(fix): index file: prevent malformed absolute path (#1346)
When `org-roam-directory` doesn't end with trailing slash and `org-roam-index-file` contains relative filename, absolute path to org-roam index file returned by `org-roam--get-index-path` is malformed and invalid. Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
This commit is contained in:
19
org-roam.el
19
org-roam.el
@ -868,17 +868,14 @@ plist containing the path and title for the file."
|
||||
The path to the index can be defined in `org-roam-index-file'.
|
||||
Otherwise, it is assumed to be a note in `org-roam-directory'
|
||||
whose title is 'Index'."
|
||||
(let* ((index org-roam-index-file)
|
||||
(path (pcase index
|
||||
((pred functionp) (funcall index))
|
||||
((pred stringp) index)
|
||||
('nil (user-error "You need to set `org-roam-index-file' before you can jump to it"))
|
||||
(wrong-type (signal 'wrong-type-argument
|
||||
`((functionp stringp)
|
||||
,wrong-type))))))
|
||||
(if (f-relative-p index)
|
||||
(concat (expand-file-name org-roam-directory) path)
|
||||
index)))
|
||||
(let ((path (pcase org-roam-index-file
|
||||
((pred functionp) (funcall org-roam-index-file))
|
||||
((pred stringp) org-roam-index-file)
|
||||
('nil (user-error "You need to set `org-roam-index-file' before you can jump to it"))
|
||||
(wrong-type (signal 'wrong-type-argument
|
||||
`((functionp stringp)
|
||||
,wrong-type))))))
|
||||
(expand-file-name path org-roam-directory)))
|
||||
|
||||
;;;; dealing with file-wide properties
|
||||
(defun org-roam--set-global-prop (name value)
|
||||
|
Reference in New Issue
Block a user