can now decode torrent as JSON in the HTTP API

This commit is contained in:
Igor Katson 2024-08-19 18:46:50 +01:00
parent 52beec9296
commit 04cfe9fc6b
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
3 changed files with 61 additions and 3 deletions

View file

@ -42,6 +42,9 @@ impl<'a> std::fmt::Display for HexBytes<'a> {
}
fn debug_bytes(b: &[u8], f: &mut std::fmt::Formatter<'_>, debug_strings: bool) -> std::fmt::Result {
if b.is_empty() {
return Ok(());
}
if b.iter().all(|b| *b == 0) {
return write!(f, "<{} bytes, all zeroes>", b.len());
}