add nothing text on empty result

This commit is contained in:
yggverse 2025-09-08 22:16:59 +03:00
parent 20d9a5e573
commit ea47c33e5a

View file

@ -279,23 +279,27 @@ fn list(
b.push("## Recent\n".into());
for torrent in torrents {
let i: TorrentMetaV1Owned = torrent_from_bytes(&torrent.bytes)?;
b.push(format!(
"=> /{} {}",
i.info_hash.as_string(),
i.info
.name
.as_ref()
.map(|n| n.to_string())
.unwrap_or_default()
));
b.push(format!(
"{} • {} • {}\n",
torrent.time.format(&config.format_date),
format::total(&i),
format::files(&i),
))
if torrents.is_empty() {
b.push("Nothing.\n".into())
} else {
for torrent in torrents {
let i: TorrentMetaV1Owned = torrent_from_bytes(&torrent.bytes)?;
b.push(format!(
"=> /{} {}",
i.info_hash.as_string(),
i.info
.name
.as_ref()
.map(|n| n.to_string())
.unwrap_or_default()
));
b.push(format!(
"{} • {} • {}\n",
torrent.time.format(&config.format_date),
format::total(&i),
format::files(&i),
))
}
}
b.push("## Navigation\n".into());