On 01/11/2022 12:40, Ihor Radchenko wrote:
See the attached new version of the patch.
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 15a9cf2de..e4fb7eb84 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2688,7 +2688,16 @@ (defun org-odt-link (link desc info)
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
((string= type "file")
- (org-export-file-uri raw-path))
+ (pcase (org-export-file-uri raw-path)
+ (`(and (pred #'file-name-absolute-p) ,path)
+ path)
I am in doubts if this branch may be executed at all. For absolute file
names `org-export-file-uri' adds "file:" prefix so I expect that
`file-name-absolute-p' is always false.
+ (path
+ (if (string-prefix-p "file://" path)
+ path
+ ;; OpenOffice treats base directory inside the odt
+ ;; archive. The directory containing the odt file
+ ;; is "../".
+ (concat "../" path)))))
(t raw-path)))
;; Convert & to & for correct XML representation
(path (replace-regexp-in-string "&" "&" path)))
This time I am not lucky enough to accidentally face a case with invalid
link URI. However I do not think that for the link
[[file:file-b.org]]
"../file-b.org" is appropriate default description. I do not expect
"../" here.