You are not logged in.

#1 2021-06-27 18:30:44

daneel971
Member
Registered: 2008-03-28
Posts: 197

[solved] qbittorrent WEB UI: download instead of open UI

I run qbittorrent-nox with WEB UI on my home server. Starting today I noticed that when I try to access the web ui with any browser (firefox, chrome, chromium) with any OS (linux, win10, android) the browser opens a download dialog asking me what to do with the file instead of displaying the login page of the web ui.
Paclog doesn't list anything related to html, firefox or bittorrent.
Does someone have a clue?

Last edited by daneel971 (2021-08-08 10:09:30)

Offline

#2 2021-07-12 13:11:20

mgbob
Member
Registered: 2013-07-03
Posts: 7

Re: [solved] qbittorrent WEB UI: download instead of open UI

Today I updated my NAS and now I have the same issue, there's a bug opened.

The interesting part is that I downgraded to 4.3.3-1 (it worked before doing a system update) and I still have the same issue.

Did you find any workaround for this?

Offline

#3 2021-07-12 23:42:59

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: [solved] qbittorrent WEB UI: download instead of open UI

Sorry no fix, and just wanted add that this isn't a general issue atleast, as I just tested and cannot reproduce with either qbittorrent-nox or full client. Temporarilly rename '~/.config/qBittorrent' with webUI closed and retry, though cannot see what in old profile should be able to trigger such, but regardless. I tested opening 'localhost:8080' in qutebrowser and chromium without issues.

Last edited by mhertz (2021-07-12 23:43:52)

Offline

#4 2021-07-13 14:46:28

mgbob
Member
Registered: 2013-07-03
Posts: 7

Re: [solved] qbittorrent WEB UI: download instead of open UI

I backed up ~/.config/qBittorrent and started fresh, same issue.

I tried with another WebUI, VueTorrent, to see if there's an issue on the actual WebUI code. I have the same issue, it just prompts to download the index.html file.

Tonight I'll set up transmission-cli to replace qbittorrent until I have the time to debug.

Either way, thank you.

Offline

#5 2021-07-13 16:58:36

daneel971
Member
Registered: 2008-03-28
Posts: 197

Re: [solved] qbittorrent WEB UI: download instead of open UI

I suspect there is something wrong with mime file associations. I renamed the entire old .config directory to _config.bak and started fresh, it worked - but it was a PITA.

Offline

#6 2021-07-13 18:12:53

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: [solved] qbittorrent WEB UI: download instead of open UI

Yeah, I came back here to post just that(mimetype-related), but you beat me to it smile I googled this, as per the detailed info by mgbob and indeed is a very prevailent issue, not on qbittorrent persay but upon alot of other webpages people have this "downloading of index.html instead of opening" issue with. As stated by daneel971, then most people have mimetype issues regarding this, usually in webserver setups, reverse-proxies etc, so google how fix, as I have no knowledge of that honestly(.htaccess files and whatnot), but some had stranger issues where worked if cleaning cache in browser(i'd guess shift+F5 reload would be fine to test such), enabling adblock or using incognito/private mode, adding '/' after full-url or prepend specifically 'http://', etc.

Check with e.g. 'curl -I localhost:8080' or whatever(or browser dev-tools etc), what content-type is defined as, which should be text/html as is here and working. Some had issues with type application, binary or attachement.

Also could check qbt-log under '~/.local/share/qBittorrent/logs/qbittorrent.log'.

Anyway, not qbittorrent user myself, but was intrigued so quickly tested smile Good luck.

Last edited by mhertz (2021-07-13 18:48:36)

Offline

#7 2021-07-17 03:10:01

riaqn
Member
Registered: 2021-03-20
Posts: 7

Re: [solved] qbittorrent WEB UI: download instead of open UI

I confirm that I have the same issue.

Offline

#8 2021-07-22 17:16:51

riaqn
Member
Registered: 2021-03-20
Posts: 7

Re: [solved] qbittorrent WEB UI: download instead of open UI

Offline

#9 2021-07-31 22:48:29

Rogach
Member
Registered: 2017-10-03
Posts: 17

Re: [solved] qbittorrent WEB UI: download instead of open UI

The issue was reproducing on my machine, I went debugging, and I think it's not qBittorrent's fault.

tl;dr - you probably need to remove files referencing x-extension-html from your ~/.local/share/mime/packages/ and run update-mime-database ~/.local/share/mime.

Looking through the source code of qBittorrent we can see that they use qt's QMimeDatabase to determine what to send in Content-Type header. (I was intrigued by the fact that they re-implement the HTTP server themselves, but I guess that this implementation predates most popular http server libraries)

A small qt5 program can be used to verify that indeed detected mime type is incorrect:

// compile with g++ -std=c++14 -fPIC -o test test.cpp -I/usr/include/qt -I/usr/include/qt/QtCore -Wall /usr/lib/libQt5Core.so
#include <QDebug>
#include <QString>
#include <QMimeDatabase>

int main() {
  QString path("index.html");
  QString data("<!DOCTYPE html><html><body></body></html>");
  QMimeType mimeType {QMimeDatabase().mimeTypeForFileNameAndData(path, data.toLatin1())};
  qInfo() << mimeType;
}

Output:

QMimeType("application/x-extension-html")

QMimeDatabase comes from qt5-base package, and by bisecting the package history I found that the wrong mime type started to appear from version 5.15.2+kde+r203. Changes in that package version consist only of bumping the commit from b8841b34 to d23de39d. There are only 3 commits in that range, and only one looks promising: Update shared-mime-info to the 2.1 release, adjust implementation. shared-mime-info contains no references to x-extension-html, and never did - so most probably the changes to mime-type match priorities resulted in different mime detection.

According to docs about mime-types, we can find mime type definitions either in /usr/share/mime/packages/ or in ~/.local/share/mime/. The former doesn't contain any references to x-extension-html, but in the latter I found the file ~/.local/share/mime/packages/user-extension-html.xml, and several others that were created at the same time. These files were created about a year ago, and unfortunately I can't find what could have created them. I suspect that was something related to Wine or Proton, because that day I was playing some games via Steam.

So I think that these definitions are useless and can be safely removed - rm user-extension-*htm*.xml. Then we need to regenerate the mime database with update-mime-database ~/.local/share/mime. Now our small program gives the correct output:

QMimeType("text/html")

And the qBittorrent web GUI also works as it should.

Offline

#10 2021-08-15 01:46:06

z0mb1e_kgd
Member
Registered: 2020-11-10
Posts: 16

Re: [solved] qbittorrent WEB UI: download instead of open UI

Thanks Rogach, your solution works indeed. Let me add a couple of things to keep in mind:

1. It should be done on the qBittorrent server system, not the client one - I somehow got it wrong at first that it was the client that misinterpreted the incoming data;

2. The QT app you've provided gave zero output unless export QT_LOGGING_RULES='*.debug=true' had been run before - qInfo() is suppressed while the QT debug mode is off (that is default).

Offline

#11 2021-08-21 18:55:58

pfdint
Member
Registered: 2013-11-18
Posts: 43

Re: [solved] qbittorrent WEB UI: download instead of open UI

Further details for minimal installs, as I had a qt5-base-headless install:

update-mime-database belongs to the package extra/shared-mime-info
to run it on a user's xdg dir use

mkdir -p ~/.local/share/mime/packages
update-mime-database ~/.local/share/mime

You are NOT then free to uninstall shared-mime-info
(unless you plan to never restart qbittorrent.)

The error may manifest differently depending on browser setup: the html may be displayed as a page of text and the response header for content type will literally be 'content-type' then newline, no colon or anything.

Last edited by pfdint (2021-08-21 19:20:57)

Offline

Board footer

Powered by FluxBB