Links in property drawers

Hi everyone and thanks for creating this awesome tool!

I like to keep my links to other files in a special connections property like so:

* Headline
:PROPERTIES:
:Connections: [[file:2020-06-24--190152.org][other file]]
:END:

The problem is, that org-roam doesn’t recognize links that are in properties as backlinks.
This happens in the function org-roam--extract-links at the line

(org-element-map (org-element-parse-buffer) 'link
...

this function skips over property drawers.

For now I have a workaround, where I’m advicing org-roam--extract-links.
Before the functions gets called, I add all of the properties to the end of the buffer as regular strings and after it, I revert the buffer again. Here is the code for that:

(defun ch/org-extract-properties-as-string-from-property-drawer ()
  "Extract all properties in buffer as string."
  (let ((str ""))
    (org-element-map (org-element-parse-buffer) 'node-property
      (lambda (prop)
        (let ((key (org-element-property :key prop))
              (val (org-element-property :value prop)))
          (setq str (concat str "* :" key ": " val "\n"))
        ))
      )
    str
    ))

(defun ch/org-insert-properties-into-buffer ()
  "Insert all values from properties and insert them at the end of current buffer."
  (interactive)
  (let ((props (ch/org-extract-properties-as-string-from-property-drawer)))
    (goto-char (point-max))
    (newline)
    (insert props)
    ))

(defun ch/revert-buffer ()
  (interactive)
  (revert-buffer t t t))

(advice-add 'org-roam--extract-links :before #'ch/org-insert-properties-into-buffer)
(advice-add 'org-roam--extract-links :after #'ch/revert-buffer)

That works for now, and I get the correct backlinks, but it’s kind of dirty. I don’t know how many other people have this workflow, but would it be possible to change org-roam--extract-links to look for links inside of properties?

I just bumped into the same problem.

There’s a closed issue about this here: Unable to link from :PROPERTIES: drawer..