Bug 69462 - hyperlinks containing single quote in their URL fail to open under XFCE (exo-open)
Summary: hyperlinks containing single quote in their URL fail to open under XFCE (exo-...
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.7.2 release
Hardware: Other Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA target:4.2.0
Keywords: possibleRegression
Depends on:
Blocks:
 
Reported: 2013-09-17 11:22 UTC by denis.prost
Modified: 2015-12-15 22:08 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description denis.prost 2013-09-17 11:22:40 UTC
when I try to open from libreoffice writer an hyperlink whose URL contains ")", I get an error message like :

Steps to reproduce:
1. create a document with ")" in its name
2. move it, for example, in a dropbox folder
3. get from your web browser the dropbox URL corresponding to that file
4. create a libreoffice writer document and insert inside it an hyperlink with that target
5. ctrl+click on that hyperlink

Current behavior:

libreoffice fails with an error box :
---------
Failed to execute default Web Browser

Text ended before matching quote was found for '. (The text was '/usr/bin/firefox https://www.dropbox.com/s/8go9xomni33agg2/2013-09-16%20CR%20r%C3%A9union%20communication%20sur%20%22l'emploi%20con%C3%A7u%20comme%20un%20droit%22%20(DP).pdf').
-----------

Expected behavior:

URL opens in firefox

              
Operating System: Linux (Other)
Version: 4.1.1.2 release
Last worked in: 3.6.7.2 release
Comment 1 Urmas 2013-09-17 18:19:41 UTC
Cannot reproduce in Windows: Firefox encodes/decodes apostrophe automatically.
Comment 2 denis.prost 2013-09-17 19:49:32 UTC
Thanks for taking care of this bug report.
You mean "right parenthesis" ? This is a parenthesis problem, not apostrophe.
Comment 3 Julien Nabet 2013-09-18 19:25:07 UTC
Denis: do you mean the title is wrong? In clear, is it a problem of apostroph or parenthesis?
Comment 4 denis.prost 2013-09-18 19:31:20 UTC
I just noticed that, when there is no right parenthesis in the filename, the hyperlink is properly opened from libreoffice writer, while when there is one, it is not. So, unless I miss something, the problem is related to right parenthesis and, to my point, that should appear in the title.
Comment 5 Julien Nabet 2013-09-18 19:34:46 UTC
Denis: don't hesitate to edit the title then :-)
Comment 6 denis.prost 2013-09-18 19:39:24 UTC
OK, I didn't dare doing it since you had changed it and I supposed you were better informed than I about what was behind it, but if it's all right for you, I'm going to revert it to the first one.
Comment 7 Robinson Tryon (qubit) 2013-10-16 03:52:28 UTC
NO REPRO in Ubuntu 12.04.3 + LO 4.1.2.3

Steps:
1) Open LibreOffice Writer
2) Paste-in the text of a url with a right-paren in it:

http://some.server.here/url_has_a_right_paren)_in_it

3) Hit [Enter] at the end of the line to turn the text into a url
4) Ctrl-click the url to open it in a browser
5) The browser will try to open the url as written (but will give an error because the domain name given above is not in DNS).

---

Changing 'regression' -> 'PossibleRegression' until we have independent confirmation of this bug.

Denis: Please try my repro steps and report back on the results. If you can ONLY reproduce this bug with Dropbox urls, please make a comment to that effect and mention Dropbox in the title of this bug.
Comment 8 denis.prost 2013-10-16 07:00:06 UTC
Hello Qubit, 
thanks for taking care of that bug report.

I tried the steps you mentioned : I get the same result as you.
But if I replace your URL by this one : 

http://2013-10-08 CR réunion d'organisation Patrick Frédéric Denis (DP).pdf

I get the error message I mentioned in comment #1.

And if I remove the single quote, the problem disappears.

So it looks that I was wrong and the problem comes from single quote (I will change the bug report title).
Comment 9 Robinson Tryon (qubit) 2013-10-16 14:53:29 UTC
(In reply to comment #8)
> But if I replace your URL by this one : 
> 
> http://2013-10-08 CR réunion d'organisation Patrick Frédéric Denis (DP).pdf
> 
> I get the error message I mentioned in comment #1.
> 
> And if I remove the single quote, the problem disappears.

Hi Denis,

Based on my testing I get some mixed results. I can't trigger an error message, but it looks like the URL isn't always properly passed to the browser.


(Testing on
Ubuntu 12.04.3
LO 4.1.2.3 and LO 3.5.7.2
FF 24
Chromium 28.0.1500.71
)

Steps:
1) Open LibreOffice Writer
2) Select from the Menu: Insert -> Hyperlink
3) Use a URL with an apostrophe in it for the 'Target':

(A) http://bla.blah'doo.com
(B) http://2013-10-08 CR réunion d'organisation Patrick Frédéric Denis (DP).pdf

4) Put "Test Me" into the 'Text' field
5) Click 'Apply' and then 'Close'
6) Try to open the resulting URL using Ctrl-click

RESULT (A): A browser window will open and will show the URL in the Address bar (note that Chromium will percent-encode the URL):
FF: http://bla.blah'doo.com/
Chromium: http://bla.blah%27doo.com/

Both browsers warn than they were unable to access the website/server.

RESULT (B): A browser window will open, but will show the home page. The specified URL will not be present in the Address bar  (Same behavior observed when FF/Chromium is set as the Default Browser).


IS THE URL LEGAL?
In doing some research, I ran across this bug (which will provide you with more information than you probably ever wanted to know about apostrophes in URLs):
https://bugzilla.mozilla.org/show_bug.cgi?id=407172

I believe that the URLs above are legal per the RFCs mentioned in the Mozilla bug report above.

TRIAGE:
Some hyperlinks fail to open properly in browser, so this bug is valid: Changing status 'NEEDINFO' -> 'NEW'.

Bug present in 3.5.7.2, which is older than 4.1.1.2, so rolling the version field back.
Comment 10 Stephan Bergmann 2013-10-16 16:49:46 UTC
The URLs in comment 8 and comment 9, <http://2013-10-08 CR réunion d'organisation Patrick Frédéric Denis (DP).pdf> and <http://bla.blah'doo.com>, are invalid in that their authority component contains invalid characters, and it is not too surprising that browsers respond differently to them  Replace the "//" with "//example.com/" in both cases and browsers will start to respond more similarly to them.  (And about the only thing LO could do about this is not allow to enter such broken URLs into the Hyperlink dialog in the first place.)

Still, I cannot reproduce the original problem from comment 0.  Dennis, is there a chance you produce a screenshot of the "Failed to execute default Web Browser" error box?  It is not clear to me where that originates from.  Also, do you run under Gnome, KDE, or some other manager?
Comment 11 Thomas Arnhold 2013-10-16 18:18:32 UTC
The problem seems to be %221:

1. Insert this Link into the hyperlink dialog: http://www.google.de/%20TEST%221

2. This translates to the link: http://www.google.de/ TEST"

3. Clicking on this link leads to (in the browser): http://www.google.de/%20TEST"

The problem seems to be the quotation mark aka %221.
Comment 12 denis.prost 2013-10-16 19:19:51 UTC
(In reply to comment #10)
> 
> Still, I cannot reproduce the original problem from comment 0.  Dennis, is
> there a chance you produce a screenshot of the "Failed to execute default
> Web Browser" error box?  It is not clear to me where that originates from. 
> Also, do you run under Gnome, KDE, or some other manager?

Thanks Stephan, you got it ! The problem was desktop environment related : I was running XFCE, but when I tried the same steps of comment #0 with KDE or MATE, it worked !

So I'm closing this bug and will file one to XFCE people.
Thanks to all and sorry for the noise.

Denis
Comment 13 Stephan Bergmann 2013-10-17 06:34:24 UTC
(In reply to comment #12)
> (In reply to comment #10)
> > 
> > Still, I cannot reproduce the original problem from comment 0.  Dennis, is
> > there a chance you produce a screenshot of the "Failed to execute default
> > Web Browser" error box?  It is not clear to me where that originates from. 
> > Also, do you run under Gnome, KDE, or some other manager?
> 
> Thanks Stephan, you got it ! The problem was desktop environment related : I
> was running XFCE, but when I tried the same steps of comment #0 with KDE or
> MATE, it worked !
> 
> So I'm closing this bug and will file one to XFCE people.
> Thanks to all and sorry for the noise.

Not so quick---the different desktops affect LO in that it has three different scripts it can call when launching a browser, depending on desktop either program/gnome-open-url, program/kde-open-url, or the fallback program/open-url.

Now, in the fallback program/open-url there is indeed line 65 where the argument is not properly quoted,

  if echo $1 | grep '^mailto:' > /dev/null; then

where $1 should rather read "$1" with quotes around it.

What's strange is that that appears to not make a difference when I test it here; maybe a variance in Bash.

Denis, if you manually fix that line in your LO installation, does it work even under XFCE then?
Comment 14 Stephan Bergmann 2013-10-17 07:39:39 UTC
Denis, another way to find out exactly where things start to go wrong for you in the open-url script is to add a line

  set -x

directly after the first line ("#!/bin/sh") of your LO installation's program/open-url, start you LO installation's program/soffice from a terminal window and capture the output that gets printed when you ctrl+click on the hyperlink (when running under XFCE).
Comment 15 denis.prost 2013-10-17 07:45:25 UTC
(In reply to comment #14)
> Denis, another way to find out exactly where things start to go wrong for
> you in the open-url script is to add a line
> 
>   set -x
> 
> directly after the first line ("#!/bin/sh") of your LO installation's
> program/open-url, start you LO installation's program/soffice from a
> terminal window and capture the output that gets printed when you ctrl+click
> on the hyperlink (when running under XFCE).

Thanks Stephan for your tip.
I could reproduce the problem from command line, trying to open the URL with exo-open, the utility used by XFCE to open files/URL.
So this is definitely an XFCE bug.
I reported it here : 
https://bugzilla.xfce.org/show_bug.cgi?id=10410
Comment 16 Stephan Bergmann 2013-10-17 08:32:17 UTC
* The missing quoting in echo $1 was indeed a red herring, I fixed that cosmetic issue nevertheless with <http://cgit.freedesktop.org/libreoffice/core/commit/?id=7ff0a2e41c872dbfacf132ff756ed10dc8f3e8c7> "Quoting clean-up" now.

* I discovered one case in the open-url script where things could go wrong, though, when there is no xdg-open installed and Thunderbird is called with a -remote openURL(...,new-window) command, verbatim parentheses or commas in the URL would prevent Thunderbird from parsing that openURL command.  I fixed that independent issue with <http://cgit.freedesktop.org/libreoffice/core/commit/?id=fcdde111e451f84e373c67a485c87d1ad744cfe4> "fdo#69462 Properly escape URL in Mozilla -remote openURL(...) command" now.
Comment 17 Commit Notification 2013-10-17 08:39:53 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

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

fdo#69462 Properly escape URL in Mozilla -remote openURL(...) command



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 18 Robinson Tryon (qubit) 2015-12-15 22:08:56 UTC
Migrating Whiteboard tags to Keywords: (PossibleRegression)
[NinjaEdit]