From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WNNKNImxYGNanAAAbAwnHQ (envelope-from ) for ; Tue, 01 Nov 2022 06:41:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kFsXNImxYGM/MAAA9RJhRA (envelope-from ) for ; Tue, 01 Nov 2022 06:41:29 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 87BC23CCC1 for ; Tue, 1 Nov 2022 06:41:29 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opk0S-0003BG-Tc; Tue, 01 Nov 2022 01:40:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opk0Q-0003B7-JY for emacs-orgmode@gnu.org; Tue, 01 Nov 2022 01:40:10 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opk0N-00017G-Td for emacs-orgmode@gnu.org; Tue, 01 Nov 2022 01:40:10 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 38C58240026 for ; Tue, 1 Nov 2022 06:40:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667281205; bh=loMayEVWh47Tknxn1n3KS62zo2mrtR4lTHcd+VmUPxI=; h=From:To:Cc:Subject:Date:From; b=dxDYlITfDRFsV4j1aKqDyrp1eK0Q4wRZPwmLAbkrvXxaJF56pLt2CVIrCHt8kQxKw ccbrNTYVnT8Ze3BVAOvuJfObxJ4MSIE+T9nFcz5P/gcdM516f4niukFgf5hplgf1nC v4ML/eE8E9ThaqB5SXvS2yWeJ4JcF/CSY+Km3aT9aXF/Pd/vV79muxLAzAuAVh+06P J/A/G9u2jT49uDvaS6/Onnh9q+AaxBl0yTDucvNr9RiJrPM6jbPuspI7Ak+9I+2G1f AWbe9cyxZBJZorAgEpFlspp+2L8kTzIF5Vx6jprhuZfwM59d13T/K1kzpV72e+OOeX tWKLA2G7CHwOg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N1f426R3zz6tr3; Tue, 1 Nov 2022 06:40:02 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]) In-Reply-To: References: <877d0xfu9m.fsf@localhost> <877d0wayn8.fsf@localhost> <87lep97tnn.fsf@localhost> <87ilkc30wd.fsf@localhost> <87ilk0jzab.fsf@localhost> Date: Tue, 01 Nov 2022 05:40:45 +0000 Message-ID: <87iljzjkpu.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667281289; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GWEHjF2U9Ze3Z0SOzPrjgZM9WjhVSWAiqzwIrTju8zU=; b=NdgrRXSyAnnleDnIlCuP0hPLkp2s8YY3AYqU9IgEeff9z/i7E4ahhkZfCaeWXEkgc0sutx a4Vwqbg4Oe+wlgunpO3wRfGF7MgGJ1mgIf+E/94ADWjHJNOR9ix+dpx+5RpwNa8YmgaTsN gbaXKQTAYCFrVrVWpN51Rt8GEcxM6bY0bIZ/uYUzjo7BIhLOQlQbLMMP+QQ0Cprleq/Lq5 ETAImyt6XbJJTkun3QA3vNKvLHkv7rfdDPEquNBv5qwA4886zBbDGINganEwkGGRYfR5h5 ULWgt4CTP8IES1PVE3OiucQIf81tSRPEB0yeKYPlZZ6pmxhb7rQZMNnU/yZhWQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667281289; a=rsa-sha256; cv=none; b=ilDST+n5BBVwnXEAikV0AD2ELjMLgIIXemLFH6U7US9HhxLgh1toMTner/c2pc5HkISbbL a6WqLYLTSi7FtLfFy5RkiaQtEsaj4jHVHZ/3OkUZJ0vDQ2dLyjN+F6OOg6fusgLY4YIGs8 44DBBst216qoxVUSMgUudIseWSOlIZz+VVAbL+/jRARsMPPz6nNAB4rZzTFtU7IRO0XZ7v j82q6f6SOF1O+bR4T0taEDhXiGOik/wE43CX+C1YBB9INcQQD6se9NXAcqqSBUh+w4ZgC1 5W/47e1STIfLOE0Nx+iao7g9riX6hkgeDMFkUeqmpfJJrQhFGY509VRbIRfFxA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=dxDYlITf; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.24 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=dxDYlITf; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 87BC23CCC1 X-Spam-Score: -2.24 X-Migadu-Scanner: scn0.migadu.com X-TUID: OdQMvqGr7UAU --=-=-= Content-Type: text/plain Max Nikulin writes: > [[file:~/examples/org/odt-id/file-b.org]] link is exported as > ./file:///home/user/examples/org/odt-id/file-b.org Thanks! See the attached new version of the patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-org-odt-link-Fix-relative-file-links.patch >From 8ee8528366bbf31ed8510f005e032176711d15b9 Mon Sep 17 00:00:00 2001 Message-Id: <8ee8528366bbf31ed8510f005e032176711d15b9.1667280462.git.yantar92@posteo.net> From: Ihor Radchenko Date: Mon, 31 Oct 2022 14:11:19 +0800 Subject: [PATCH v2] org-odt-link: Fix relative file links * lisp/ox-odt.el (org-odt-link): Append an extra "../" to relative links. This is needed to conform with OpenOffice convention to treat base path inside the odt archive. The path containing the odt file is thus "../". Reported-by: Ihor Radchenko Link: https://orgmode.org/list/87ilkc30wd.fsf@localhost --- lisp/ox-odt.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) + (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))) -- 2.35.1 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--