Bug 121472 - Link to cell in external document doesn't work (wrong file URL)
Summary: Link to cell in external document doesn't work (wrong file URL)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.0.6.2 release
Hardware: x86-64 (AMD64) macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.2.0 target:7.1.1
Keywords: bibisected, bisected, regression
: 122015 (view as bug list)
Depends on:
Blocks: Calc-External-Datalink
  Show dependency treegraph
 
Reported: 2018-11-16 21:29 UTC by Michael Kallweitt
Modified: 2021-01-20 12:56 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Document to be targeted by cell references (4.64 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2020-10-26 08:16 UTC, Gabor Kelemen (allotropia)
Details
Example document with cell references to the previous document (11.25 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-10-26 08:20 UTC, Gabor Kelemen (allotropia)
Details
attachment # 166721 saved before the regression causing commit (7.76 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2020-10-26 08:23 UTC, Gabor Kelemen (allotropia)
Details
attachment # 166721 saved after the regression causing commit (7.72 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2020-10-26 08:23 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kallweitt 2018-11-16 21:29:38 UTC
Description:
When opening a calc document (xlsx format) containing a cell which references to another calc document, the cell won't update due to a malformed file name (URL). This is the error message:

Die folgende externe Datei konnte nicht geladen werden. Die verknüpften Daten aus dieser Datei wurden nicht aktualisiert.

file:///Users/michael/Nextcloud/Documents/Projekte/2018/Paulusviertel/Orga/Users/michael/Nextcloud/Documents/Projekte/2018/Paulusviertel/Orga/Kopie von Leerformular.xls

For some reason in the URL above, the part containing the target directory ('/Users/…/Orga') is duplicated.

Steps to Reproduce:
1. Create a Calc document with a reference to a cell in another Calc document
2. Save document in XLS format (Microsoft Excel 2007-2013 XML)
3. Close document window
4. Open previously saved document
5. Confirm request to update external values

Actual Results:
Die folgende externe Datei konnte nicht geladen werden. Die verknüpften Daten aus dieser Datei wurden nicht aktualisiert.

file:///Users/michael/Nextcloud/Documents/Projekte/2018/Paulusviertel/Orga/Users/michael/Nextcloud/Documents/Projekte/2018/Paulusviertel/Orga/Kopie von Leerformular.xls

Expected Results:
Cell values should be updated without error


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 m_a_riosv 2018-11-16 23:20:25 UTC
Looks like a dup, please if you are not agree reopen it.

*** This bug has been marked as a duplicate of bug 76047 ***
Comment 2 Gabor Kelemen (allotropia) 2020-10-26 08:15:13 UTC
This is the first report of path duplication of cell references in XLSX files. Not a duplicate, since this started in 6.0 with:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=51e610e584e09ecdec4cbc5c7c550bc806d7ee1c

author	Szymon Kłos <szymon.klos@collabora.com>	2017-08-24 09:59:42 +0200
committer	Szymon Kłos <szymon.klos@collabora.com>	2017-08-25 09:58:15 +0200 

tdf#111876 Save correct relative links in Calc

I'll attach example files. To reproduce:

Have a file named Target.xlsx with some contents and create a new file with simple cell reference to this file: = + click on the cell in the other Calc dialog:
='file:///home/gabor/Documents/Target.xlsx'#$Sheet1.C2

This is saved correctly in ods format, but not in XLSX when "Save URLs relative to file system" is enabled on Options - Load/Save - General and the files are next to each other or below in the file system. Resulting cell reference will be:

='file:///home/gabor/Documents/home/gabor/Documents/Target.xlsx'#$Sheet1.C2

This somehow happens only on Linux/Mac and not on Windows.

Relevant XLSX snippet:

/xl/externalLinks/_rels/externalLink1.xml.rels
<?xml version="1.0" encoding="UTF-8"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
  <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath" Target="Target.xlsx" TargetMode="External"/>
</Relationships>

This changes in the newer versions to have: 
Target="home/gabor/Documents/Target.xlsx"
Comment 3 Gabor Kelemen (allotropia) 2020-10-26 08:16:25 UTC
Created attachment 166719 [details]
Document to be targeted by cell references
Comment 4 Gabor Kelemen (allotropia) 2020-10-26 08:20:41 UTC
Created attachment 166721 [details]
Example document with cell references to the previous document

I also made copies of Target.xlsx as 
~/Documents/TargetBelow/TargetBelow.xlsx for the second line (referencing this is exported bad the same way)

and 
/tmp/TargetTop.xlsx for the third row (referencing this did not work before either)
Comment 5 Gabor Kelemen (allotropia) 2020-10-26 08:23:00 UTC
Created attachment 166722 [details]
attachment # 166721 [details] saved before the regression causing commit

No path duplication yet, reference to file in /tmp row however was exported as 
='file:///home/gabor/Documents/tmp/TargetTop.xlsx'#$Sheet1.C2
Comment 6 Gabor Kelemen (allotropia) 2020-10-26 08:23:48 UTC
Created attachment 166723 [details]
attachment # 166721 [details] saved after the regression causing commit

Path duplication started here.
Comment 7 Gabor Kelemen (allotropia) 2020-10-26 08:27:19 UTC
*** Bug 122015 has been marked as a duplicate of this bug. ***
Comment 8 Gabor Kelemen (allotropia) 2020-10-26 08:28:42 UTC
Adding CC to: Szymon Klos
Comment 9 Commit Notification 2020-12-23 10:17:10 UTC
Attila Szűcs committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/610153dd28b57ea2670f5cf240e4da9655fb7093

tdf#121472 XLSX export: fix external Linux path

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2021-01-19 10:39:41 UTC
Attila Szűcs committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/95b1411e26c1a82e110a8ccf970b8b3590427cb9

tdf#121472 XLSX export: fix external Linux path

It will be available in 7.1.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Gabor Kelemen (allotropia) 2021-01-20 12:56:37 UTC
This seems to be fixed now in:

Version: 7.2.0.0.alpha0+
Build ID: 5adc93a9a9426ef79054751be2904896f787a8a2
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: threaded

I see no path duplication in freshly saved xlsx file.
Thanks Attila for fixing this!