Bug 46002 - xdg-open replaces "&" with "%U" in URLs
Summary: xdg-open replaces "&" with "%U" in URLs
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: 1.1.0 rc1
Hardware: Other other
: low trivial
Assignee: Portland Bugs
QA Contact:
Keywords: patch
Depends on:
Reported: 2012-02-13 10:27 UTC by Paweł Kosiński
Modified: 2012-03-02 11:23 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Correction suggested in comment #0 (857 bytes, patch)
2012-02-28 12:27 UTC, Cyprien Nicolas
Details | Splinter Review

Description Paweł Kosiński 2012-02-13 10:27:18 UTC
What to do?
xdg-open "http://one.two/three&four"

What happen?
In web browser URL "http://one.two/three%Ufour" is opened.

What should happen?
URL "http://one.two/three&four" should be opened.

Someone said what to do here: https://www.libreoffice.org/bugzilla/show_bug.cgi?id=44046
It's enough to replace line 546 with:

argone=`echo $1|sed 's/&/\\\\&/g'`
arguments_exec="`echo $arguments | sed -e 's*%[fFuU]*"'"$argone"'"*g'`"

Then everything works well. :)
Comment 1 Cyprien Nicolas 2012-02-28 12:27:48 UTC
Created attachment 57778 [details] [review]
Correction suggested in comment #0

Annoying bug actually.

The summary is not quite right, it should be xdg-open: open_generic_xdg_mime replaces "&" with %[fFuU] depending on what has been found in the .desktop file

The issue is due to sed replacing any '&' character in the replacement expression by the matched expression. This resulting having all the & characters replaced by the %U or %F that has to be replaced in the argument list.

I attach a patch for the correction proposed in comment #0, successfully tested on my machine.
Comment 2 Rex Dieter 2012-02-28 12:43:56 UTC

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.