Bug 1467130

Summary: Firefox unable to handle magnet links
Product: [Fedora] Fedora Reporter: Douglas <doug.hs>
Component: firefoxAssignee: Jan Horak <jhorak>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 26CC: bugzilla, doug.hs, gecko-bugs-nobody, jhorak, kengert, l4coa3fnjplr, mike, pjasicek, somlo, stransky
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-29 11:31:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Error message after clicking a magnet link
none
"Applications" section on Firefox showing no magnet entry none

Description Douglas 2017-07-03 00:52:26 UTC
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-03 00:54:44 UTC
Created attachment 1293694 [details]
"Applications" section on Firefox showing no magnet entry

Comment 2 Jan Horak 2017-07-12 07:17:05 UTC
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 15:44:09 UTC
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 21:24:19 UTC
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-19 02:38:54 UTC
It started working today, after applying a few updates. Did you fix it?

Comment 6 Jan Horak 2017-07-19 06:29:59 UTC
No actually, I was not able to reproduce it. Please reopen if reoccurs.

Comment 7 Douglas 2017-07-23 12:42:17 UTC
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 06:16:14 UTC
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 18:35:09 UTC
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 05:40:51 UTC
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 17:44:29 UTC
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 11:35:53 UTC
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 12:13:32 UTC
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-14 00:23:30 UTC
Just updated my F26 Workstation and got firefox-56.0-4.fc26.x86_64, but magnet links did NOT start working for me.

Comment 15 Douglas 2018-03-14 22:31:40 UTC
Can no longer reproduce with Firefox 58.0.2

Comment 16 Fedora End Of Life 2018-05-03 09:02:15 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 17 Fedora End Of Life 2018-05-29 11:31:55 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.