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

Refactor magnet link parsing logic and add new test cases #7815

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

drew2a
Copy link
Contributor

@drew2a drew2a commented Jan 12, 2024

This PR refactors the parse_magnetlink function to use libtorrent.parse_magnet_uri for parsing magnet links, as it seems safer and more convenient to rely on the native libtorrent parsing mechanism instead of our own.

It is includes:

  • Added a new test case for parsing a magnet link with a wrong hash.
  • Added a new test case for parsing a magnet link with bytes input.
  • Removed two existing test cases that were testing invalid infohashes, as they are no longer needed.

This refactoring was carried out during the work on:

@drew2a drew2a force-pushed the refactoring/parse_magnetlink branch 2 times, most recently from 04c3966 to 2d60398 Compare January 12, 2024 16:33
@drew2a drew2a marked this pull request as ready for review January 15, 2024 10:23
@drew2a drew2a requested review from a team and egbertbouman and removed request for a team January 15, 2024 10:23
@drew2a drew2a force-pushed the refactoring/parse_magnetlink branch from 8040ba5 to 73bb8ac Compare January 15, 2024 13:11
- Refactored the `parse_magnetlink` function to use `libtorrent.parse_magnet_uri` for parsing magnet links.
- Added a new test case for parsing a magnet link with a wrong hash.
- Added a new test case for parsing a magnet link with bytes input.
- Removed two existing test cases that were testing invalid infohashes, as they are no longer needed.
@drew2a drew2a force-pushed the refactoring/parse_magnetlink branch from 73bb8ac to ba9582e Compare January 15, 2024 13:22
@drew2a drew2a merged commit 5ee5491 into Tribler:main Jan 15, 2024
20 checks passed
@drew2a drew2a deleted the refactoring/parse_magnetlink branch January 15, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants