Fix downloaded size in the torrent list
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

The downloaded size should never be more than the total size.
This commit is contained in:
Grégoire Delattre 2020-04-15 17:16:26 +02:00
parent 135ddd0c93
commit 93e427fc73

View File

@ -16,8 +16,11 @@ export const Progress = ({ torrent }) => {
} }
// Pretty sizes // Pretty sizes
const downloadedSize = prettySize(torrent.status.downloaded_size);
const totalSize = prettySize(torrent.status.total_size); const totalSize = prettySize(torrent.status.total_size);
const downloadedSize =
torrent.status.downloaded_size >= torrent.status.total_size
? totalSize
: prettySize(torrent.status.downloaded_size);
const downloadRate = prettySize(torrent.status.download_rate) + "/s"; const downloadRate = prettySize(torrent.status.download_rate) + "/s";
return ( return (
<div> <div>