Bug 160162 - Hyperlink to Draw page does not update after change in page position, since LO 6.4
Summary: Hyperlink to Draw page does not update after change in page position, since L...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
6.4.0.3 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Hossein
URL:
Whiteboard: target:24.8.0 target:24.2.3 target:7.6.7
Keywords: bibisected, bisected, regression
: 160110 (view as bug list)
Depends on:
Blocks: Hyperlink
  Show dependency treegraph
 
Reported: 2024-03-12 07:56 UTC by Stéphane Guillou (stragu)
Modified: 2024-03-14 10:22 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Guillou (stragu) 2024-03-12 07:56:55 UTC
Steps:
1. Open Draw
2. Add two extra pages, to have 3 in total
3. On page 1, add a text box and write some text in it
4. Select some text, Ctrl + K to add a link > Document > Target in Document > Target button > Click "Page 3" > Apply > Close
5. Ctrl + click on the link: it jumps to page 3
6. Remove page 2
7. Ctrl + click again on page 1 link

Result: no jump to target. Links to "#Page 3" still.
Expected: goes to page 2 (new position of original page 3). Links to "#Page 2".

Impress is not affected.
Still repro in recent trunk build:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f42363c51672a5b3685b0b9b11e932680530dce3
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

And on Windows 11.

Bibisected with linux-64-6.4 to first bad build [af1f648888333a06fc35bec76967d652367b1cf2] which points to:

commit 942d1d2ea59bf4605f2c464a6b29c967fa9f8de8
author	Muhammet Kara 	Wed Oct 23 09:50:26 2019 +0300
committer	Muhammet Kara 	Wed Oct 23 11:17:08 2019 +0200
tdf#112126: Correct naming for pages in Draw
Reviewed-on: https://gerrit.libreoffice.org/81364

(Before that commit, same steps can be followed with "Slide" instead of "Page". Link would update as expected.)

Muhammet, could you please have a look?
Comment 1 Stéphane Guillou (stragu) 2024-03-12 08:13:54 UTC
*** Bug 160110 has been marked as a duplicate of this bug. ***
Comment 2 Hossein 2024-03-12 15:31:03 UTC
If you try renaming the slides to "P1, P2, and P3" and then remove "P2", you will see that the link is no longer updated, but as the page number is also no longer updated, the link will continue to work.

So, there are 2 things here. When a page is renamed and/or removed, or a new page is created in the middle of others:
1. Renaming the pages is done to update its name according to its position, which is only done when original name is preserved. Here, "Page" is used instead of "Slide", and renaming works. If you remove "Page 2", "Page 3" becomes "Page 2".
2. Changing the links to keep them up-to-date. This is also done only when the name "Slide" is preserved.  It does not currently work with "Page".

I am changing SdDrawDocument::UpdatePageRelativeURLs() to fix this issue.

Another issue, I see many duplicate names of "Default" in the latest version when trying to insert links via "Target in Document":

Notes > Default
Handouts > Default
Master Page > Default
Comment 3 Stéphane Guillou (stragu) 2024-03-12 15:44:06 UTC
Thanks for looking into it, Hossein.
Please note relevant comments in associated bugs:
- bug 139472 comment 4 (internal link broken by change in UI language, inherited)
- bug 105282 comment 15 (form control internal link doesn't update when it should, inherited)

(In reply to Hossein from comment #2)
> Notes > Default
> Handouts > Default
> Master Page > Default
Noticed that as well, something for another report. Notes and Handouts are not relevant to Draw so shouldn't even be listed. And also, the section with the pages is still called "Slides".
Comment 4 Hossein 2024-03-12 15:58:51 UTC
(In reply to Stéphane Guillou (stragu) from comment #3)
> Thanks for looking into it, Hossein.
> Please note relevant comments in associated bugs:
> - bug 139472 comment 4 (internal link broken by change in UI language,
> inherited)
> - bug 105282 comment 15 (form control internal link doesn't update when it
> should, inherited)
You're welcome! The below patch should fix the specific issue discussed here:

tdf#160162 Fix hyperlink update in Draw
https://gerrit.libreoffice.org/c/core/+/164716

For the others, more changes will be needed.
Comment 5 Commit Notification 2024-03-12 23:39:22 UTC
Hossein committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c1f097854f89f35cfc0f097a10384014042b95d6

tdf#160162 Fix hyperlink update in Draw

It will be available in 24.8.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 6 Stéphane Guillou (stragu) 2024-03-13 00:27:16 UTC
Thanks Hossein! Verified the fix in my own build on Linux.

Follow-up report, while you're looking at that function: bug 160174.
Comment 7 Commit Notification 2024-03-13 19:48:52 UTC
Hossein committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/2ad14fdade187579b2abf3c76a08780b77614662

tdf#160162 Fix hyperlink update in Draw

It will be available in 24.2.3.

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 8 Commit Notification 2024-03-14 10:22:40 UTC
Hossein committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/58352309d1299cbbaf465991f5cec17c2ae32cee

tdf#160162 Fix hyperlink update in Draw

It will be available in 7.6.7.

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.