-
Notifications
You must be signed in to change notification settings - Fork 3
Description
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
-
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
#[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