Bug 1467130 - Firefox unable to handle magnet links
Firefox unable to handle magnet links
Status: NEW
Product: Fedora
Classification: Fedora
Component: firefox (Show other bugs)
26
x86_64 Linux
unspecified Severity low
: ---
: ---
Assigned To: Jan Horak
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-02 20:52 EDT by Douglas
Modified: 2017-10-13 20:23 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-19 02:29:59 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Error message after clicking a magnet link (56.72 KB, image/png)
2017-07-02 20:52 EDT, Douglas
no flags Details
"Applications" section on Firefox showing no magnet entry (85.33 KB, image/png)
2017-07-02 20:54 EDT, Douglas
no flags Details

  None (edit)
Description Douglas 2017-07-02 20:52:26 EDT
Created attachment 1293693 [details]
Error message after clicking a magnet link

Description of problem:

Firefox doesn't set a magnet handler, despite having Transmission torrent client installed.

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

Firefox 54.0

How reproducible:

Always.

Steps to Reproduce:
1. Run Firefox
2. Find a place to download from a magnet link
3. Try to download it

Actual results:

Every time I click a magnet link, I am redirected to a white page with an error message saying it couldn't find a handler for it.

Expected results:

It is expected to run Transmission right after clicking the magnet link, and no prompts appear whatsoever.

Additional info:

I have already deleted my profiles and reset Firefox to default settings, also reinstalled both Firefox and Transmission. No change. This is a recently installed clean Fedora 25 with no fancy modifications and no extra repos.

SELinux doesn't show any warning.
Comment 1 Douglas 2017-07-02 20:54 EDT
Created attachment 1293694 [details]
"Applications" section on Firefox showing no magnet entry
Comment 2 Jan Horak 2017-07-12 03:17:05 EDT
Could you please try if the xdg-open opens transmission from command line?
For example:
xdg-open 'magnet:?xt=urn:sha1:6de6a83d402817ef5116d28072f9dd6b0600c6d6&dn=OOo_2.1.0_LinuxIntel_install_en-US.tar.gz&xs=http://mirror.switch.ch/ftp/mirror/OpenOffice/stable/2.1.0/OOo_2.1.0_LinuxIntel_install_en-US.tar.gz'

and what:
xdg-mime query default x-scheme-handler/magnet
says
Comment 3 Douglas 2017-07-12 11:44:09 EDT
Jan Horak,

It opened Transmission, but nothing more. It couldn't open the magnet.
Here's the output:

[alquimista@alq14 ~]$ xdg-open 'magnet:?xt=urn:sha1:6de6a83d402817ef5116d28072f9dd6b0600c6d6&dn=OOo_2.1.0_LinuxIntel_install_en-US.tar.gz&xs=http://mirror.switch.ch/ftp/mirror/OpenOffice/stable/2.1.0/OOo_2.1.0_LinuxIntel_install_en-US.tar.gz'
[alquimista@alq14 ~]$ 
(transmission-gtk:4883): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
** Message: Skipping unknown torrent
"magnet:///?xt=urn:sha1:6de6a83d402817ef5116d28072f9dd6b0600c6d6&dn=OOo_2.1.0_LinuxIntel_install_en-US.tar.gz&xs=http://mirror.switch.ch/ftp/mirror/OpenOffice/stable/2.1.0/OOo_2.1.0_LinuxIntel_install_en-US.tar.gz"


The second command:

[alquimista@alq14 ~]$ xdg-mime query default x-scheme-handler/magnet
transmission-gtk.desktop
[alquimista@alq14 ~]$ 

I'm running 26 now. Clean install.
Comment 4 Douglas 2017-07-12 17:24:19 EDT
I just realized the magnet you gave me isn't working, so I tried with another:

[alquimista@alq14 ~]$ xdg-open 'magnet:?xt=urn:btih:c8386c4211bff55f9c191323fed96ce142507732&dn=Steve+Roach+-+New+Life+Dreaming&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969'
[alquimista@alq14 ~]$ 
(transmission-gtk:5518): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed

It worked now. Transmission opened, asking me where to save the files.
Comment 5 Douglas 2017-07-18 22:38:54 EDT
It started working today, after applying a few updates. Did you fix it?
Comment 6 Jan Horak 2017-07-19 02:29:59 EDT
No actually, I was not able to reproduce it. Please reopen if reoccurs.
Comment 7 Douglas 2017-07-23 08:42:17 EDT
Same thing, again. It's so random.

I reinstalled Fedora Workstation 26 on both of my laptops, then I updated the installs and rebooted; and installed Transmission. After that I kept failing to open magnet links on both. Firefox doesn't know what to do with magnets. I don't think there's anything I can tell I did to make it work. Completely random to me.

Any other output I can get?
Comment 8 IanB 2017-08-17 02:16:14 EDT
I'm having the same issue with Firefox 55 and qBittorrent on F26. 

It's been broken for some time. I can't recall if it's worked since the upgrade to F26, but it was definitely working in F25.
Comment 9 Mike Goodwin 2017-08-25 14:35:09 EDT
I can confirm 

firefox-55.0.2-1.fc26.x86_64

Doesn't matter what bittorrent client. Even manually adding `network.protocol-handler.expose.magnet` which is an oft-cited fix for this doesn't do anything. There is no magnet association.

What actually does work is adding:

"magnet":{"action":4}

inside "schemes":{} 

In ~/.mozilla/firefox/<default_profile>/handlers.json

(be careful it's minified, so I used `python -m json.tool < handlers.json` and output a temporary file to edit by hand first, then copy it over handlers.json (or keep a backup) - firefox will re-minify it upon restarting.)

You can then go into Preferences -> Applications and set the magnet application to your liking.

Not really sure why this is messed up to begin with, though.
Comment 10 Jan Horak 2017-08-28 01:40:51 EDT
This might be related to the https://bugzilla.mozilla.org/show_bug.cgi?id=1297686 I'm working on the support for obtaining list of scheme handlers from GIO, but it will take a while until it will be ready. 

I'm able to reproduce in rawhide, so I'll try to look into it.
Comment 11 Douglas 2017-09-10 13:44:29 EDT
I was able to reproduce this with Arch Linux, Ubuntu 17.04 and many other distros with updated Firefox versions. I reported upstream here:

https://bugzilla.mozilla.org/show_bug.cgi?id=1394182

But I couldn't do what they asked me to do.
Comment 12 Jan Horak 2017-10-12 07:35:53 EDT
This is the upstream bug where we actually started debugging it: https://bugzilla.mozilla.org/show_bug.cgi?id=1400803
Please check if disabling e10s helps there, to disable e10s go to about:config
and set browser.tabs.remote.autostart to false.
Comment 13 IanB 2017-10-12 08:13:32 EDT
Magnet links have started working again for me - now on firefox-56.0-4.fc26.x86_64. It may have been fixed in a previous minor version, but I haven't tested opening a magnet link until just now.
Comment 14 Gabriel Somlo 2017-10-13 20:23:30 EDT
Just updated my F26 Workstation and got firefox-56.0-4.fc26.x86_64, but magnet links did NOT start working for me.

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