Bug 98064 - Copying rich text HTTP Link does not Ampersand character in URL properly
Summary: Copying rich text HTTP Link does not Ampersand character in URL properly
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Paste
  Show dependency treegraph
 
Reported: 2016-02-21 20:25 UTC by ka
Modified: 2019-12-21 03:33 UTC (History)
5 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 ka 2016-02-21 20:25:22 UTC
When pasting a rich text HTTP link into OO Writer, the link text is correctly inserted but the URL is wrong when an ampersand character is contained in the URL.

Example: Coypying the following HTML-Snippet

<a href="http://example.com/index.php?oid=1&pid=2">Linktext</a>

results in an OO Writer hyperlink with a URL where "&pi" is erroneously translated into the greek PI character. This makes the URL unusable.
Comment 1 Buovjaga 2016-03-02 18:38:48 UTC
Works ok here.

Version: 5.1.0.3 64-bit
Build ID: 5.1.0.3 Arch Linux build-1
CPU Threads: 8; OS Version: Linux 4.4; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Comment 2 Robinson Tryon (qubit) 2016-03-06 18:08:40 UTC
Testing on Ubuntu 14.04 +
LO 5.2.0.0.alpha0+ (2016-02-24_23:58:47)

(In reply to ka from comment #0)
> Example: Coypying the following HTML-Snippet
> <a href="http://example.com/index.php?oid=1&pid=2">Linktext</a>
> 
> results in an OO Writer hyperlink with a URL where "&pi" is erroneously
> translated into the greek PI character.

Pasting the URL into Writer works fine for me; the ampersand is handled correctly.

You mention 'OO Writer': are you using LibreOffice or OpenOffice for your testing?

Status -> NEEDINFO
Comment 3 ka 2016-03-07 15:55:56 UTC
Sorry, I meant LibreOffice. Just tested it in V.5.1.0.3, the bug is still there.
In the meantime I was able to narrow down the bug somewhat. Misinterpretation of the ampersand character in the query string occurs when clipboard html text contains the URL like so:

<!--StartFragment--><a href="http://example.com/index.php?oid=1&pid=2">Linktext</a><!--EndFragment-->

If the html text fragment is given with "&amp;" like so:

<!--StartFragment--><a href="http://example.com/index.php?oid=1&amp;pid=2">Linktext</a><!--EndFragment-->

then LO understands the pasted link correctly.
Comment 4 Aron Budea 2016-12-18 05:57:29 UTC
I couldn't reproduced in LibreOffice 5.2.3.3, or 5.1.0.3 / Windows 7, either.
Can you check with a current version, and if the bug is still reproducible, write down the exact steps how you copy and paste the link into Writer?
Comment 5 ka 2016-12-18 13:46:40 UTC
Just re-tested it in LO 5.2.3.3 - Still doesn't work. Immediately after pasting the link into LO Writer I can see in the tooltip and the URL property that the string "&pid=" is translated to "πd=". Upon clicking the link takes me into Firefox with the wrong URL too.
Comment 6 ka 2016-12-18 14:23:35 UTC
Additional info: The Link is generated in a website via clipboard.js (https://github.com/lgarron/clipboard.js)
I can verify with Free Clipboard Viewer that the HTML content of the clipboard is correct. If I paste the link into Google Docs it is correct, if I paste it into LO it is wrong.
Comment 7 ka 2016-12-18 15:41:17 UTC
I created a test website to demonstrate what happens:
http://geotek.de/static/cliptest/
Comment 8 Buovjaga 2016-12-18 16:25:47 UTC
(In reply to ka from comment #7)
> I created a test website to demonstrate what happens:
> http://geotek.de/static/cliptest/

Ok, I get the problem.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.4.0.0.alpha0+
Build ID: db9aec4520766c87a09d4cb0238ed06ebaeaaeeb
CPU Threads: 8; OS Version: Linux 4.8; UI Render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on December 18th 2016

Arch Linux 64-bit
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 9 Aron Budea 2016-12-19 01:18:08 UTC
The bug is around here:

cChar = GetHTMLCharName( sEntity );
http://opengrok.libreoffice.org/xref/core/svtools/source/svhtml/parhtml.cxx#488

It parses alphanumeric characters, and finds "pid", which corresponds to no HTML character (this is the above point in the code), and afterwards it tries if any prefix of it does, and finds "pi".
Comment 10 QA Administrators 2017-12-20 03:35:17 UTC Comment hidden (obsolete)
Comment 11 QA Administrators 2019-12-21 03:33:25 UTC
Dear ka,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug