FS#28011 - [xdg-utils] xdg-open seems to ignore the "x-scheme-handler/magnet" handler
Attached to Project:
Arch Linux
Opened by Danilo (danilo) - Friday, 20 January 2012, 12:20 GMT
Last edited by Andreas Radke (AndyRTR) - Tuesday, 16 October 2012, 15:32 GMT
Opened by Danilo (danilo) - Friday, 20 January 2012, 12:20 GMT
Last edited by Andreas Radke (AndyRTR) - Tuesday, 16 October 2012, 15:32 GMT
|
Details
I'm trying to open Deluge when clicking on a magnet:-Link in
Chromium. Chromium relies on xdg-open to handle URLs.
If i'm not mistaken, the mime type of a magnet link is "x-scheme-handler/magnet". I tried to set the mime type handler the following ways: * `xdg-mime default deluge.desktop application/x-bittorrent x-scheme-handler/magnet` * By editing `~/.local/share/applications/mimeapps.list` directly (`x-scheme-handler/magnet=deluge.desktop;`) The mime type has apparently been set correctly. $ xdg-mime query default "x-scheme-handler/magnet" deluge.desktop But xdg-open does not behave correctly. `xdg-open magnet:?xt=blablabla` opens an empty tab in chromium instead of launching Deluge. According to this thread, this is a bug in /bin/xdg-open: https://bbs.archlinux.org/viewtopic.php?pid=1034478#p1034478 Additional info: * package version: extra/xdg-utils 1.1.0rc1-3 |
This task depends upon
Closed by Andreas Radke (AndyRTR)
Tuesday, 16 October 2012, 15:32 GMT
Reason for closing: Fixed
Additional comments about closing: snapshot updated to latest git version
Tuesday, 16 October 2012, 15:32 GMT
Reason for closing: Fixed
Additional comments about closing: snapshot updated to latest git version
$ xdg-mime query default "x-scheme-handler/magnet"
$
Returns nothing. Just a fresh prompt.
$ xdg-open magnet:?xt=foo
magnet:?xt=foo
magnet:?xt=foo
A more serious problem was that the open_generic function was not properly calling the open_generic_xdg_mime function. Something bad was happening along the way, but rather than untangle what looked like a somewhat complicated bit of code, I hacked a quick and dirty solution and merely tested for the presence of the "magnet:?xt=" string in the main part of the script, running the open_generic_xdg_mime function if the string was found. That fixed it right up.
My patch is not meant to represent finished work; it's a quick and dirty patch of a patch that works for me and I am sharing it only to shed further light on the underlying bug. All credit to tepidlake, all criticism to me.
It is possible that my particular problems with the original patch are due to the fact that I'm not even running Arch Linux. I'm running Debian 6.0, with Xfce 4.6.2, and on a backported 3.2 kernel from the Debian repos (version 3.2.0-0.bpo.2-amd64). But since I found the solution to this problem on an Arch Linux forum, other people running various distros may also chance upon it -- the underlying bug certainly doesn't appear to be distro-specific.
(I'm using Chrome version 18.0.1025.168, but it shouldn't matter as this bug is not browser-related.)
Bug 45859 - xdg-open fails to open a url in a "generic" environment
https://bugs.freedesktop.org/show_bug.cgi?id=45859
I have posted about it to the arch-general too:
http://mailman.archlinux.org/pipermail/arch-general/2012-June/027247.html