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

Fix: Change relevance to double on peers info dto #20

Merged
merged 1 commit into from
May 21, 2024

Conversation

bhaan
Copy link
Contributor

@bhaan bhaan commented May 20, 2024

I got an exception calling subscribeTorrentPeersData on the SyncController. The client has the PeerInfo.relevance datatype as an int?, but the API appears to be sending a double. While the documentation doesn't appear to have any information for this response object, I see that the WebUI renders the "relevance" column in the "peers" tab as a percent, suggesting that the API is responding with a value between 0 and 1.

This change updates the datatype to be double? rather than int?.

This is the stacktrace I received:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'double' is not a subtype of type 'int?' in type cast
#0      _$PeersInfoFromJson (package:qbittorrent_api/src/v2/sync/dto/peers_info.g.dart:23:36)
#1      new PeersInfo.fromJson (package:qbittorrent_api/src/v2/sync/dto/peers_info.dart:27:7)
#2      _$PeersDataFromJson.<anonymous closure> (package:qbittorrent_api/src/v2/sync/dto/peers_data.g.dart:12:41)
...

@yosemiteyss yosemiteyss merged commit 1f15314 into yosemiteyss:main May 21, 2024
1 check passed
@yosemiteyss
Copy link
Owner

thx!

@bhaan bhaan deleted the fix-peers-relevance-type branch May 21, 2024 14:02
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.

2 participants