Bug 120003 - FILEOPEN: DOC: the first letter of a link URL to a picture get missing
Summary: FILEOPEN: DOC: the first letter of a link URL to a picture get missing
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:6.2.0 target:6.1.3
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2018-09-20 08:34 UTC by kivi
Modified: 2018-10-28 03:04 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Demo files for first letter of a URL missing (275.01 KB, application/zip)
2018-09-20 08:34 UTC, kivi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kivi 2018-09-20 08:34:22 UTC
Created attachment 145053 [details]
Demo files for first letter of a URL missing

Sorry but I could not decide what is the correct special word - ЕDITING, FILESAVE, FILEOPEN or some thing else.

Wnen create a document in Writer and put a URL as a link to a picture there, then save and close the document and then open it again, the first letter of the URL get missing.
So if customer will click the picture will not access the needed link.

Let say I have created a document put there some picture and make a link to http://demo.org for this picture.
Before to close the document if I click this picture by mouse my browser will open the needed url (http://demo.org)
If then I will save the document and close it and open it again, then the URL of the link of the picture will become ttp://demo.org.
If then I will do it again this URL will become tp://demo.org, next time will get p://demo.org and so on.

What is needed?
We need this URL given to some picture to stay unchanged.
Comment 1 Julien Nabet 2018-09-20 10:09:14 UTC
kivi: any better with LO version 6.1.1?
Comment 2 Dieter Praas 2018-09-21 11:37:39 UTC
(In reply to kivi from comment #0)
> Created attachment 145053 [details]
> Wnen create a document in Writer and put a URL as a link to a picture there,
> then save and close the document and then open it again, the first letter of
> the URL get missing.

The files in your attachment are doc-files. But you said, you create a document in writer. Does it only happen, if you save it as doc(x), or also, if you save it as odt?
Comment 3 kivi 2018-09-21 18:27:23 UTC
The same problem exists also in LibreOffice 6.1
This problem is not available with odt files.

When I have same demo file as odt and save it as docx the commented link completely disappeared in the docx.
Also if I try the same file but in docx,after every save, close and reopen the needed link get missing.
Comment 4 BogdanB 2018-09-21 18:58:51 UTC
Could you make a video showing how letters are lost? And how you reproduce this bug?
Comment 5 Nicolas Christener 2018-09-30 11:15:55 UTC
I think I can confirm this issue. How I reproduce it:

* Create new writer document
* Menu: Insert > Image ...
* Chose image, in my case a simple jpg file
* Select the image (click it so it has the focus)
* ctrl+k or Menu: Insert > Hyperlink...
  - URL: https://www.libreoffice.org
* Click "OK" button
* Save the document as doc (Microsoft binary format) and close the doc
* Open the doc again
* Verify the URL by selecting the image and typing ctrl+k

Expected result in the "URL" field: https://www.libreoffice.org
Actual result in the "URL" field: tps://www.libreoffice.org/%00

Doing the same with docx (Microsoft XML format):

Expected result in the "URL" field: https://www.libreoffice.org
Actual result in the "URL" field: empty

I'm using:
 
Version: 6.1.1.2
Build ID: 10(Build:2)
CPU threads: 4; OS: Linux 4.18; UI render: default; VCL: gtk3; 
Locale: en-US (en_CH.UTF-8); Calc: group threaded
Comment 6 BogdanB 2018-09-30 11:30:43 UTC
(In reply to Nicolas Christener from comment #5)
> I think I can confirm this issue. How I reproduce it:

Great, nice way to reproduce. I can reproduce on:
Version: 6.2.0.0.alpha0+
Build ID: 67c8049a3abcaf9aa692fc9ba768b5db9fbb2f05
CPU threads: 4; OS: Linux 4.15; UI render: GL; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2018-09-25_20:09:22
Locale: ro-RO (ro_RO.UTF-8); Calc: threaded

I use 6.2 to create the .doc file and also to open the document after saving...

The link appear like 

tp://link/%00
Comment 7 Julien Nabet 2018-10-11 19:35:14 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.
Indeed I don't reproduce this with odt.

Miklos: thought you might be interested in this one since it seems related to doc and docx filters
Comment 8 Xisco Faulí 2018-10-17 12:40:07 UTC
This is an importing problem...

Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=9b77f8142bf665a47c3a179e3fe3f82623a99f8a

author	Caolán McNamara <caolanm@redhat.com>	2017-04-06 15:08:45 +0100
committer	Caolán McNamara <caolanm@redhat.com>	2017-04-07 09:02:45 +0000
commit	9b77f8142bf665a47c3a179e3fe3f82623a99f8a (patch)
tree	6aee5ab0ec475499fa20f0485bdcb16853b5a79f
parent	60aac84fc83ca6d527d06cf4ce031d7ef5ffee48 (diff)
ditch ReadRawUniString
This thing is defined by MS-OSHARED, there FWIW, the 8 bit encoding is "ANSI",
which is somewhat useless, use the same GetCharSetFromLanguage() attempt we use
elsewhere when that problem arises

Bisected with: bibisect-linux-64-5.4

Adding Cc: to Caolán McNamara
Comment 9 Commit Notification 2018-10-17 20:12:47 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=99fa8d59f8cc3f06ce4fbe6b5ec834e9e30ae3b4

Resolves: tdf#120003 missing prefix to link url in .doc import

It will be available in 6.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 10 Xisco Faulí 2018-10-18 09:57:47 UTC
Verified in

Version: 6.2.0.0.alpha0+
Build ID: 5fb66ae5595b7435e8954df31473fad15a74b8c2
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-US (ca_ES.UTF-8); Calc: threaded
Comment 11 Commit Notification 2018-10-18 09:59:46 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=faf048080124a4e1c9fcb4637fa9541921c758bd&h=libreoffice-6-1

Resolves: tdf#120003 missing prefix to link url in .doc import

It will be available in 6.1.4.

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

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2018-10-27 18:24:54 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-1-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e40c944e8e654228e1893fc1bded8e1bded41ee7&h=libreoffice-6-1-3

Resolves: tdf#120003 missing prefix to link url in .doc import

It will be available in 6.1.3.

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

Affected users are encouraged to test the fix and report feedback.