-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat(isMagnetURI): support Bittorrent v2 #1992
feat(isMagnetURI): support Bittorrent v2 #1992
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1992 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 103 103
Lines 2097 2099 +2
Branches 473 474 +1
=========================================
+ Hits 2097 2099 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR @Rhilip and congrats for your first contribution 🎉
I Also remove the restrict of xt=urn: after magnet:?, since Magnet_URI_scheme Format notice:
Nice catch! LGTM
Please review again, thanks! Before: const magnetURIComponent = /xt(?:\.1)?=urn:((?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?|btmh:1220[a-z0-9]{64})($|&)/i;
const testWrongMagnetURI = 'magnet:?ttxt=urn:btmh:1220caf1e1c30e81cb361b9ee167c4aa64228a7fa4fa9f6105232b28ad099f3a302e';
magnetURIComponent.test(testWrongMagnetURI); // return true, which is completed wrong |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your changes @Rhilip. I added a little suggestion concerning your regex, feel free to check it!
Co-authored-by: Sarhan Aissi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! Thank you @Rhilip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your contrib! 🎉
BitTorrent introduced the btmh: protocol in 2020 as part of its BitTorrent v2 changes. https://blog.libtorrent.org/2020/09/bittorrent-v2/
This schema like:
magnet:?xt=urn:btmh:1220{64 hashs}
And This pull request will let
isMagnetURI
function support vaild this schema.I Also remove the restrict of
xt=urn:
aftermagnet:?
, since Magnet_URI_scheme Format notice:Checklist