Bug 106553 - Hyperlink to filename containing spaces or other URL-encodable characters is mangled upon examination with End key, if name is longer than input field
Summary: Hyperlink to filename containing spaces or other URL-encodable characters is ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Hyperlink-Calc
  Show dependency treegraph
 
Reported: 2017-03-15 17:01 UTC by Melnikov Vasiliy
Modified: 2023-11-01 16:50 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
normal file (8.51 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-03-16 15:32 UTC, Melnikov Vasiliy
Details
corrupted file (8.52 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-03-16 15:33 UTC, Melnikov Vasiliy
Details
Video showing the creation of the document (1.81 MB, video/x-msvideo)
2017-03-16 20:07 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Melnikov Vasiliy 2017-03-15 17:01:49 UTC
Description:
Document content is invalid

Steps to Reproduce:
1. new calc document
2. select some cell and press Ctrl-K
3. fill Path field with filepath like it:
"e:\_works docs\2014 - Кнопки на мнемосхеме\Котлеты отдельно мухи отдельно.txt"
(without quotes)
4. enter some short text to field Text
5. close settings window
6. trying go to link - it worked
7. second time press Ctrl-K
link text was converted to:
file:///e:/_works%20docs/2014%20-%20%D0%9A%D0%BD%D0%BE%D0%BF%D0%BA%D0%B8%20%D0%BD%D0%B0%20%D0%BC%D0%BD%D0%B5%D0%BC%D0%BE%D1%81%D1%85%D0%B5%D0%BC%D0%B5/%D0%9A%D0%BE%D1%82%D0%BB%D0%B5%D1%82%D1%8B%20%D0%BE%D1%82%D0%B4%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE%20%D0%BC%D1%83%D1%85%D0%B8%20%D0%BE%D1%82%D0%B4%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE.txt
ok it can be normal
8. click on Path field to see it
9. click Apply, and then Ok
10. link is damaged

Actual Results:  
Create new document

Expected Results:
The link should not be damaged when viewing properties


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0
Comment 1 Buovjaga 2017-03-16 10:01:05 UTC Comment hidden (obsolete)
Comment 2 Melnikov Vasiliy 2017-03-16 15:32:22 UTC
Created attachment 131936 [details]
normal file

It is the source file
Comment 3 Melnikov Vasiliy 2017-03-16 15:33:12 UTC
Created attachment 131937 [details]
corrupted file
Comment 4 Melnikov Vasiliy 2017-03-16 15:45:04 UTC
Here is source normal file and file with corrupted link.


And this is a video how i did it
https://www.dropbox.com/s/gl35cdgsum5urg1/Calc%20link.avi?dl=0

It's need to open link settings click mouse on path field, then press home key, end key or arrows.

URL must be longer that field for it, if i use Cyrillic symbols each one transform to %XX and length of URL is incremented. In attached files I use only spaces as "wrong" symbols.
Comment 5 Buovjaga 2017-03-16 20:07:55 UTC
Created attachment 131948 [details]
Video showing the creation of the document
Comment 6 Buovjaga 2017-03-19 17:46:06 UTC Comment hidden (obsolete)
Comment 7 Melnikov Vasiliy 2017-03-23 15:52:00 UTC
I understand about URL encoding. 
But, link after opening settings window becomes invalid value, possible it depends from url length.
On my video: when I click on the link first time the document by link was opened in notepad. 
After open/close settings I click second time and see Message about wrong URL.
If the URL is short (no encoding depends) then it not will be corrupted.
Percentage encoding just did length bigger.
Comment 8 Buovjaga 2017-03-23 19:23:44 UTC
New steps for full enlightenment:

1. Create an empty txt file with spaces in the name, long enough that it does not fit in the Hyperlink dialog's Path input field. Example I used: Is this the real life . Is this just fantasy . Caught in a landslide . no escape from reality.txt
2. Open Calc and Ctrl-K in some cell to insert hyperlink
3. Go to Document tab, click the browse button next to Path input field, select the file you created in step 1
4. Enter some gibberish in the Text input field and click OK
5. Unfocus from the cell editing and Ctrl-click the link to check the txt file is opened
6. Ctrl-K in the hyperlinked cell to reopen the Hyperlink dialog
7. Click in the Path input field and hit End and Home on your keyboard - this is important. Notice, how when you hit End, you see the spaces and not the URL-encoded %20s.
8. Click OK and Ctrl-click the link again.

My result is:

The file or folder home/user/libobugs/Is this the real life . IsIs this the real life . Is this just fantasy . Caught in a landslide . no escape from reality.txt does not exist

So it has appended the filename in the beginning for some reason.

To confirm the theory of the URL-encoded characters, you can compare with a filename like this: Is_this_the_real_life_._Is_this_just_fantasy_._Caught_in_a_landslide_._no_escape_from_reality.txt

You can also compare by dragging the Hyperlink dialog to be very wide.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.4.0.0.alpha0+
Build ID: 6291574d9477067e14ae493d7d9e59b19c8616ab
CPU threads: 8; OS: Linux 4.10; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on March 23rd 2016

Arch Linux 64-bit
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 9 QA Administrators 2018-07-24 02:37:11 UTC Comment hidden (obsolete)
Comment 10 QA Administrators 2020-10-27 04:24:41 UTC Comment hidden (obsolete)
Comment 11 QA Administrators 2022-10-28 03:32:13 UTC Comment hidden (obsolete, spam)
Comment 12 Justin L 2023-11-01 16:50:44 UTC
Fixed in LO 6.4 with commit 1942182a3d1817bc539229d7fda3af69f7e295b8
Author: Caolán McNamara on Sun Jun 23 19:51:15 2019 +0100
    weld HyperLink Dialog