Skip to content

Commit

Permalink
fix(QbitProvider): manually add indexes to getTorrentFiles response t…
Browse files Browse the repository at this point in the history
…o provide compatibility with older version (< 4.4.0) (#1510)
  • Loading branch information
alexisig authored Feb 17, 2024
1 parent f540ccd commit 512d177
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/services/QbitProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,16 @@ export default class QBitProvider implements IProvider {
params: { hash, indexes: indexes?.join('|') }
})
.then(res => res.data)
.then(
(files: TorrentFile[]) => (files.some(file => file.index === undefined) ? files.map((file: TorrentFile, index: number) => ({ ...file, index })) : files)
/**
* We manually add indexes to the response if they are missing to provide compatibility with older versions of qbittorent (< 4.4.0)
* https://github.com/qbittorrent/qBittorrent/pull/14795
*
* We leave newer versions unaltered, as the files could be sent in different orders or be filtered
* https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-file-priority
*/
)
}

async getAvailableTags(): Promise<string[]> {
Expand Down

0 comments on commit 512d177

Please sign in to comment.