Context
As identified in PR #166 (comment: #166 (comment)), the MagnetUri struct in crates/libtortillas/src/metainfo/magnet.rs has several field type issues that should be addressed for better spec compliance:
Issues
-
xl field type: Currently u32, but can exceed 4 GiB for large torrents. Should be u64 to prevent overflow.
-
Multi-valued parameters: The following fields are currently Option<String> but can occur multiple times in magnet URIs:
as (source)
xs (exact_source)
x.pe (peer)
These should be Vec<String> with default attribute to properly capture all values.
-
Keywords handling: The kt field currently uses Vec<String> which works for repeated kt parameters, but doesn't split single values with "+" separators. May need a custom deserializer if that form is needed.
Suggested Changes
#[serde(rename = "xl")]
pub length: Option<u64>, // was u32
#[serde(rename = "as", default)]
pub source: Vec<String>, // was Option<String>
#[serde(rename = "xs", default)]
pub exact_source: Vec<String>, // was Option<String>
#[serde(rename = "x.pe", default)]
pub peer: Vec<String>, // was Option<String>
Requested by: @artrixdotdev
Related PR: #166
Context
As identified in PR #166 (comment: #166 (comment)), the
MagnetUristruct incrates/libtortillas/src/metainfo/magnet.rshas several field type issues that should be addressed for better spec compliance:Issues
xlfield type: Currentlyu32, but can exceed 4 GiB for large torrents. Should beu64to prevent overflow.Multi-valued parameters: The following fields are currently
Option<String>but can occur multiple times in magnet URIs:as(source)xs(exact_source)x.pe(peer)These should be
Vec<String>withdefaultattribute to properly capture all values.Keywords handling: The
ktfield currently usesVec<String>which works for repeatedktparameters, but doesn't split single values with "+" separators. May need a custom deserializer if that form is needed.Suggested Changes
Requested by: @artrixdotdev
Related PR: #166