diff --git a/src/services/torrent.rs b/src/services/torrent.rs index 788eec19..c3c7e7f0 100644 --- a/src/services/torrent.rs +++ b/src/services/torrent.rs @@ -45,8 +45,8 @@ pub struct AddTorrentRequest { pub struct AddTorrentResponse { pub torrent_id: TorrentId, + pub canonical_info_hash: String, pub info_hash: String, - pub original_info_hash: String, } /// User request to generate a torrent listing. @@ -172,8 +172,8 @@ impl Index { Ok(AddTorrentResponse { torrent_id, - info_hash: torrent.canonical_info_hash_hex(), - original_info_hash: original_info_hash.to_string(), + canonical_info_hash: torrent.canonical_info_hash_hex(), + info_hash: original_info_hash.to_string(), }) } diff --git a/src/web/api/server/v1/contexts/torrent/responses.rs b/src/web/api/server/v1/contexts/torrent/responses.rs index d928f675..103e3a85 100644 --- a/src/web/api/server/v1/contexts/torrent/responses.rs +++ b/src/web/api/server/v1/contexts/torrent/responses.rs @@ -11,8 +11,8 @@ use crate::web::api::server::v1::responses::OkResponseData; #[derive(Serialize, Deserialize, Debug)] pub struct NewTorrentResponseData { pub torrent_id: TorrentId, + pub canonical_info_hash: String, pub info_hash: String, - pub original_info_hash: String, } /// Response after successfully uploading a new torrent. @@ -20,8 +20,8 @@ pub fn new_torrent_response(add_torrent_response: &AddTorrentResponse) -> Json } let uploaded_torrent_response: UploadedTorrentResponse = serde_json::from_str(&response.body).unwrap(); - let canonical_info_hash_hex = uploaded_torrent_response.data.info_hash.to_lowercase(); + let canonical_info_hash_hex = uploaded_torrent_response.data.canonical_info_hash.to_lowercase(); let canonical_info_hash = InfoHash::from_str(&canonical_info_hash_hex) .unwrap_or_else(|_| panic!("Invalid info-hash in database: {canonical_info_hash_hex}"));