(fix): only update relative path of file links (#1226)

This commit is contained in:
Matt Chowning
2020-11-03 11:07:31 -05:00
committed by GitHub
parent 56c47fbff8
commit 7c83a84db3
2 changed files with 3 additions and 1 deletions

View File

@ -13,6 +13,7 @@
- [#1195](https://github.com/org-roam/org-roam/issues/1195) fix ID face showing as invalid if within Org ID files, but not Org-roam's. - [#1195](https://github.com/org-roam/org-roam/issues/1195) fix ID face showing as invalid if within Org ID files, but not Org-roam's.
- [#1199](https://github.com/org-roam/org-roam/issues/1199) make Org-roam link insertions respect `org-roam-link-title-format` everywhere. - [#1199](https://github.com/org-roam/org-roam/issues/1199) make Org-roam link insertions respect `org-roam-link-title-format` everywhere.
- [#1201](https://github.com/org-roam/org-roam/issues/1201) fix `org-roam-db-build-cache` failing in scenarios involving duplicate IDs and deleted files. - [#1201](https://github.com/org-roam/org-roam/issues/1201) fix `org-roam-db-build-cache` failing in scenarios involving duplicate IDs and deleted files.
- [#1226](https://github.com/org-roam/org-roam/issues/1226) only update relative path of file links
## 1.2.2 (06-10-2020) ## 1.2.2 (06-10-2020)

View File

@ -1321,7 +1321,8 @@ replaced links are made relative to the current buffer."
(when-let ((link (org-element-lineage (org-element-context) '(link) t))) (when-let ((link (org-element-lineage (org-element-context) '(link) t)))
(let ((type (org-element-property :type link)) (let ((type (org-element-property :type link))
(path (org-element-property :path link))) (path (org-element-property :path link)))
(when (and (f-relative-p path) (when (and (string= type "file")
(f-relative-p path)
(org-in-regexp org-link-bracket-re 1)) (org-in-regexp org-link-bracket-re 1))
(let* ((file-path (expand-file-name path (file-name-directory old-path))) (let* ((file-path (expand-file-name path (file-name-directory old-path)))
(new-path (org-roam-link-get-path file-path))) (new-path (org-roam-link-get-path file-path)))