mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(fix): fix org-roam-protocol--open-ref creating new files (#1375)
We need to split the ref into its type/file before querying the db for a match. Throw a warning when `org-roam--capture-new-file` tries to recreate an existing file.
This commit is contained in:
@ -65,18 +65,18 @@ It opens or creates a note with the given ref.
|
||||
(push (cons 'slug (funcall org-roam-title-to-slug-function title)) decoded-alist))
|
||||
(let-alist decoded-alist
|
||||
(let* ((ref (org-protocol-sanitize-uri .ref))
|
||||
(type (and (string-match "^\\([a-z]+\\):" ref)
|
||||
(type (and (string-match org-link-plain-re ref)
|
||||
(match-string 1 ref)))
|
||||
(title (or .title ""))
|
||||
(body (or .body ""))
|
||||
(orglink
|
||||
(org-link-make-string ref (or (org-string-nw-p title) ref))))
|
||||
(when org-roam-protocol-store-links
|
||||
(push (list ref title) org-stored-links))
|
||||
(org-link-store-props :type type
|
||||
:link ref
|
||||
:annotation orglink
|
||||
:initial body)))
|
||||
(push (list ref title) org-stored-links)
|
||||
(org-link-store-props :type type
|
||||
:link ref
|
||||
:annotation orglink
|
||||
:initial body))))
|
||||
(let* ((org-roam-capture-templates org-roam-capture-ref-templates)
|
||||
(org-roam-capture--context 'ref)
|
||||
(org-roam-capture--info decoded-alist)
|
||||
|
Reference in New Issue
Block a user