-
Notifications
You must be signed in to change notification settings - Fork 27
Fix tracker API error token not valid #419
Copy link
Copy link
Closed
Labels
BugIncorrect BehaviorIncorrect Behavior
Description
Relates to: #420
I've been checking the logs of the live demo. It's failing because the tracker token is not valid:
2023-12-26T11:00:35.187361844+00:00 [torrust_index::tracker::statistics_importer][INFO] Updating torrent 1 ...
2023-12-26T11:00:35.233911132+00:00 [torrust_index::tracker::service][ERROR] Failed to parse torrent info from tracker response. Body: Unhandled rejection: Err { reason: "token not valid" }
2023-12-26T11:00:35.242595113+00:00 [torrust_index::tracker::statistics_importer][ERROR] Error updating torrent tracker stats for torrent with id 1: TorrentNotFoundThere are two issues:
- Invalid token:
Token not valid - Wrong logged error:
TorrentNotFound
Invalid token
I think the problem is the token I'm using contains some special characters like %. In the API client:
pub async fn get_torrent_info(&self, info_hash: &str) -> Result<Response, Error> {
let request_url = format!("{}/torrent/{}?token={}", self.base_url, info_hash, self.connection_info.token);
let client = reqwest::Client::new();
client.get(request_url).send().await
}We are not URL-encoding the token. For example, given this the token 123g7#@agJtWFSgkdA5R$K22yeo$k6IhNq%T2$r the following URL doesn't work:
It should be:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugIncorrect BehaviorIncorrect Behavior
Type
Projects
Status
No status