feat(isMagnetURI): support Bittorrent v2#1992
feat(isMagnetURI): support Bittorrent v2#1992profnandaa merged 3 commits intovalidatorjs:masterfrom Rhilip:feat-isMagnetURI-bittorrentv2
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.
|
tux-tn
left a comment
There was a problem hiding this comment.
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 |
Co-authored-by: Sarhan Aissi <tux-tn@users.noreply.github.com>
profnandaa
left a comment
There was a problem hiding this comment.
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
isMagnetURIfunction support vaild this schema.I Also remove the restrict of
xt=urn:aftermagnet:?, since Magnet_URI_scheme Format notice:Checklist