Bug 46002

Summary: xdg-open replaces "&" with "%U" in URLs
Product: Portland Reporter: Paweł Kosiński <pk1001100011>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: trivial    
Priority: low CC: c.nicolas+bugs-freedesktop
Version: 1.1.0 rc1Keywords: patch
Hardware: Other   
OS: other   
Whiteboard:
i915 platform: i915 features:
Attachments: Correction suggested in comment #0

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.

Solution?
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
thanks!

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.