From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qF6ACrJnX2OuLAEAbAwnHQ (envelope-from ) for ; Mon, 31 Oct 2022 07:14:10 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 2Pd6CrJnX2PrfwAAauVa8A (envelope-from ) for ; Mon, 31 Oct 2022 07:14:10 +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 E5B3910D7A for ; Mon, 31 Oct 2022 07:14:09 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opO31-00038O-RP; Mon, 31 Oct 2022 02:13:23 -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 1opO2v-00037n-Pk for emacs-orgmode@gnu.org; Mon, 31 Oct 2022 02:13:17 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opO2r-0005Lp-Ui for emacs-orgmode@gnu.org; Mon, 31 Oct 2022 02:13:17 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 71D68240103 for ; Mon, 31 Oct 2022 07:13:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667196791; bh=8LlmTqTPPSAEm0qDoAD47j47DBeXcK/iAuT+8S9mC2U=; h=From:To:Cc:Subject:Date:From; b=OR6jeSp0FFkH03RE1YHJEjCW8h/U5u2Rb1DB0Jvp3ZIapE+VwITVR2CfpsgO649nz Opdbl1a1SODic4KUpy3/w1NtsDrsWvTKKY3td6MOG7g3qsVmoZpq9xMczM2j+vp2D4 F7NYuKdy9nYmJ6cpalI82uvb5MmGL9dNaH3cuudnjDPHMgJobDyMPsWOjjeDlkOebo poZEGMr78sKnINGzmnK0De2qvp5GhLp/4FOsbyQ89pktp0Joj/a1JxXZnSEuyRhqgm 2IxSuRt8Okmwv7OjNAn/RwTmJnxLYVbicUkivOSxo9DYbVZhgeG3LmDB1k5rhdhzRh jipV4ZJ4VcvnQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N12rj1rrYz6tmV; Mon, 31 Oct 2022 07:13:08 +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> Date: Mon, 31 Oct 2022 06:13:48 +0000 Message-ID: <87ilk0jzab.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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, RCVD_IN_MSPIKE_H2=-0.001, 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@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=1667196849; 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=nggt+6ouBZ4QoHNQczfTkh9Ln+dOL8zc1zJV619bwHQ=; b=bxdN4yLJHak6YO0eISnpqggudrKVvmBuyvRKGOFmyregvbDI5AiQOUCfB87Tk/UuBx9Er5 ymbDRqf+FoZZ3em+45YCg8ZtskE+PhIKLppkPzgIFDpv+GjfGE2XGZZvLAjHTDh6WyCc7v ko5Hp7sVP9RMs+YZnAd6s70KWG7qfnJxoZVWL53moqlmrSPFgUzdnDAFJWxnb+Atslr5sU 0wqfmwa5MVESMQPX22iALfLPZbIZ7Fud8RpzFJcdojBv8Fj13IuOlfTF9RKH+mOO957HOC R04dWmPzU1CAJziE/Y9LIzkgH5LJeQrKtjia3NQK2eA7sC4+niayXPzLOcLQsA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667196849; a=rsa-sha256; cv=none; b=JvFawxCeANOvd0r8nz35U0Y94AoOeT3grVKQN0rWyAF8O6h3ROOTGN71A10NbnWC0Ylsed eBOEjd8blv5KAVk7IWLzi5aqyA6JB4ERa3NPuPLnBJKMvk1/YFxsWw3pg35CZK0J8QusdQ dpEsIkzziCPMyxhrdAHIkOAaDd0CQSTT1gNyfyY7MgK45hkc+Vo1Gm5LA0j8BL7Av7SM3M mZu/Yn2vdJugJNmOJQ069jz7Xe0LcYgCUD+oELRbD1SRXqch1siBHRLGuoKg2Z4gqr/rw2 jkmlxq4nDOdpB5OT6GsXTvJo3haGHzz4m2rj52IgTcgkIUrdWM4oFoQ63xcwnw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=OR6jeSp0; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.93 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=OR6jeSp0; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: E5B3910D7A X-Spam-Score: -1.93 X-Migadu-Scanner: scn1.migadu.com X-TUID: WN/23MJ1BHZy --=-=-= Content-Type: text/plain Max Nikulin writes: > On 22/10/2022 12:03, Ihor Radchenko wrote: >> >> Probably, href=file.org is treated as a link to resource packed inside >> .odt file. > > You are right. file.odt is a virtual folder representing ZIP container, > so relative links to external files should be prefixed with "../". Thanks for checking! See the attached tentative patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-odt-link-Fix-relative-file-links.patch >From 17077b56b60a59b3b8c8d6a3634fe4ad532d114b Mon Sep 17 00:00:00 2001 Message-Id: <17077b56b60a59b3b8c8d6a3634fe4ad532d114b.1667196812.git.yantar92@posteo.net> From: Ihor Radchenko Date: Mon, 31 Oct 2022 14:11:19 +0800 Subject: [PATCH] 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 15a9cf2de..eac9cf82b 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2688,7 +2688,14 @@ (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 + ;; 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 --=-=-=--