Bug 1215895 - xdg-open escapes '&' in URIs
Summary: xdg-open escapes '&' in URIs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: xdg-utils
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Rex Dieter
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-28 05:45 UTC by Tore Anderson
Modified: 2015-10-17 22:56 UTC (History)
2 users (show)

Fixed In Version: xdg-utils-1.1.1-1.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-17 22:56:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tore Anderson 2015-04-28 05:45:59 UTC
Description of problem:

When opening an URI that has the character '&' in it, it is replaced with '\\&' in the actual URI passed to the web browser. This typically results in 404 not found errors.

Version-Release number of selected component (if applicable):

xdg-utils-1.1.0-0.39.rc3.fc21.noarch

How reproducible:

100%


Steps to Reproduce:
1. Run «bash -x /usr/bin/xdg-open 'http://fud.no/foo&bar'»

Actual results:

The browser attempts to open the URI «http://fud.no/foo\\&bar».

Expected results:

The browser should have opened the URI «http://fud.no/foo&bar».

Additional info:

In the output from «bash -x», you can see the escaping happening:

[...]
+ case $1 in
+ replaced=1
++ echo 'http://fud.no/foo&bar'
++ sed 's/[&*\\]/\\\\&/g'
+ arg='http://fud.no/foo\\&bar'
+ shift
+ set -- 'http://fud.no/foo\\&bar'
+ args=0
+ '[' 0 -gt 0 ']'
+ '[' 1 -eq 1 ']'
+ /bin/firefox 'http://fud.no/foo\\&bar'
[...]

This extremely naive patch does fix the problem for me, but probably breaks other use cases. It is only meant to illustrate where the problem lies, not as a serious attempt at a fix:

--- /usr/bin/xdg-open	2015-02-24 21:39:57.000000000 +0100
+++ /home/tore/xdg-open	2015-04-28 07:36:47.915568437 +0200
@@ -625,7 +625,8 @@
                     ;;
                 %[fFuU])
                     replaced=1
-                    arg="$(echo $target | sed 's/[&*\\]/\\\\&/g')"
+                    #arg="$(echo $target | sed 's/[&*\\]/\\\\&/g')"
+                    arg=$target
                     shift
                     set -- "$@" "$arg"
                     ;;

Comment 1 Tore Anderson 2015-06-08 05:49:08 UTC
Confirming that this bug is also present in Fedora 22 (xdg-utils-1.1.0-0.39.rc3.fc22.noarch). Updating the version attribute accordingly.

Comment 2 Fedora Update System 2015-09-30 16:53:30 UTC
xdg-utils-1.1.0-0.42.20150927git.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-a2a2502ccc

Comment 3 Fedora Update System 2015-10-04 01:37:38 UTC
xdg-utils-1.1.0-0.42.20150927git.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update xdg-utils'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-a2a2502ccc

Comment 4 Fedora Update System 2015-10-05 12:47:44 UTC
xdg-utils-1.1.0-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-a2a2502ccc

Comment 5 Fedora Update System 2015-10-06 01:08:19 UTC
xdg-utils-1.1.0-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update xdg-utils'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-a2a2502ccc

Comment 6 Fedora Update System 2015-10-07 16:26:53 UTC
xdg-utils-1.1.1-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update xdg-utils'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-a2a2502ccc

Comment 7 Fedora Update System 2015-10-17 22:56:04 UTC
xdg-utils-1.1.1-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.