Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: qBittorent: fix getClientSessionDirectory on Linux #275

Merged
merged 1 commit into from
Apr 10, 2021

Conversation

angristan
Copy link
Contributor

Description

I was getting a 500 on GET /api/torrents/{hash}/metainfo

By looking at the code, I guessed Flood wasn't able to find the torrent file.

Indeed, my qBittorent folder isn't the same as the one in the code:

qbt@sana ~> ll .local/share/data/
ls: cannot access '.local/share/data/': No such file or directory
qbt@sana ~> ll .local/share/qBittorrent/
total 164K
drwxr-xr-x 2 qbt qbt 144K Apr 10 00:44 BT_backup/
drwxr-xr-x 2 qbt qbt 4.0K Jan 24 19:27 GeoDB/
drwxr-xr-x 2 qbt qbt 4.0K Apr 10 00:33 logs/
drwxr-xr-x 3 qbt qbt 4.0K Mar 31 21:18 nova3/
drwxr-xr-x 3 qbt qbt 4.0K Jan 24 19:27 rss/

By looking at the qbt source code, it looks like the one hardcoded in Flood is the "legacy" one:

    // On Linux keep using the legacy directory ~/.local/share/data/ if it exists
    const QString legacyDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
        + QLatin1String("/data/") + profileName() + QLatin1Char('/');

    const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
        + QLatin1Char('/') + profileName() + QLatin1Char('/');

    if (!QDir(dataDir).exists() && QDir(legacyDir).exists())
    {
        qWarning("The legacy data directory '%s' is used. It is recommended to move its content to '%s'",
            qUtf8Printable(legacyDir), qUtf8Printable(dataDir));

        return legacyDir;
    }

    return dataDir;

https://github.com/qbittorrent/qBittorrent/blob/2b8e50b296f52d058f6f049dc9f00212f6ffe0e0/src/base/profile_p.cpp#L79-L84

My PR fixes my case only, but maybe we should check for both and use the one that exists (or the newest if both)?

Types of changes

  • Breaking change (changes that break backward compatibility of public API or CLI - semver MAJOR)
  • New feature (non-breaking change which adds functionality - semver MINOR)
  • Bug fix (non-breaking change which fixes an issue - semver PATCH)

@codecov
Copy link

codecov bot commented Apr 9, 2021

Codecov Report

Merging #275 (40608aa) into master (98793c1) will increase coverage by 0.10%.
The diff coverage is 14.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #275      +/-   ##
==========================================
+ Coverage   78.61%   78.71%   +0.10%     
==========================================
  Files          57       57              
  Lines        9220     9226       +6     
  Branches      907      911       +4     
==========================================
+ Hits         7248     7262      +14     
+ Misses       1961     1953       -8     
  Partials       11       11              
Impacted Files Coverage Δ
...erver/services/qBittorrent/clientGatewayService.ts 74.05% <14.28%> (-0.70%) ⬇️
server/services/interfaces/clientGatewayService.ts 97.70% <0.00%> (-2.30%) ⬇️
...rver/services/Transmission/clientRequestManager.ts 74.44% <0.00%> (-0.64%) ⬇️
server/services/index.ts 96.17% <0.00%> (+0.54%) ⬆️
server/models/FeedReader.ts 98.64% <0.00%> (+4.05%) ⬆️
server/util/feedUtil.ts 62.92% <0.00%> (+19.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98793c1...40608aa. Read the comment docs.

@jesec
Copy link
Owner

jesec commented Apr 10, 2021

Thanks. May I push to the PR to make the change compatible with both?

@angristan
Copy link
Contributor Author

Sure, thanks!

@jesec jesec merged commit adebc96 into jesec:master Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants