You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of this package are you using?
11.0.8 (current version)
What operating system, Node.js, and npm version?
All versions of node
What happened?
decodeTorrentFile flattens the announce-list array, but the nesting inside announce-list has semantic meaning, per BEP 0012. Then encodeTorrentFile has to re-nest but it only has a shallow list so it has to just assume that each announce url had its own top-level element in the list, which is not necessarily the case.
The output of this script shows that there is an extra el in between the two announce urls after being roundtripped through parse-torrent, changing the shape of the announce tree from [[1, 2]] to [[1], [2]]. The relevant code is below
What version of this package are you using?
11.0.8 (current version)
What operating system, Node.js, and npm version?
All versions of node
What happened?
decodeTorrentFile
flattens the announce-list array, but the nesting inside announce-list has semantic meaning, per BEP 0012. ThenencodeTorrentFile
has to re-nest but it only has a shallow list so it has to just assume that each announce url had its own top-level element in the list, which is not necessarily the case.The following script has a minimal reproduction.
The output of this script shows that there is an extra
el
in between the two announce urls after being roundtripped through parse-torrent, changing the shape of the announce tree from[[1, 2]]
to[[1], [2]]
. The relevant code is belowparse-torrent/index.js
Lines 155 to 160 in 4c0d4ae
parse-torrent/index.js
Lines 210 to 213 in 4c0d4ae
What did you expect to happen?
I expected parse-torrent not to lose fidelity on the shape of the announce-list.
Are you willing to submit a pull request to fix this bug?
I plan to vendor this package into my app and fix it there. I am open to upstreaming the fix, although my fix is likely to be a breaking change.
The text was updated successfully, but these errors were encountered: