[Portland-bugs] [Bug 44046] xdg-open with x-scheme-handler replaces & in URLs with %U

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Dec 26 13:38:52 PST 2011


https://bugs.freedesktop.org/show_bug.cgi?id=44046

--- Comment #1 from Adam Jacob Muller <freedesktop at adam.gs> 2011-12-26 13:38:52 PST ---
This is due to the following line in xdg-open:

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

In sed parlance the "&" is special, from the sed man page: "The replacement may
contain the special character & to refer to that portion of the pattern space
which matched"

So any & in the URL will be replaced with the arguments.

The simple fix for this is to escape & in the input string, though a more
robust fix is probably in order (not using PCRE perhaps) the following patch
fixes the problem.


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

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Portland-bugs mailing list