From f21215bc679c6493571feda24693ece2f5f74509 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 8 Sep 2017 16:54:51 +0900 Subject: [PATCH] Only display fields that aren't empty (post trim) --- src/ui/add_torrent.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ui/add_torrent.js b/src/ui/add_torrent.js index 141efc5..f47203a 100644 --- a/src/ui/add_torrent.js +++ b/src/ui/add_torrent.js @@ -341,14 +341,21 @@ class AddTorrent extends Component { {magnet && "Magnet link" || file.name}
- {Object.keys(details).map(key => - torrent[key] && ( + {Object.keys(details).map(key => { + const val = torrent[key]; + if (!val) { + return null; + } + if (typeof val === "string" && !val.trim()) { + return null; + } + return (
{key}
{details[key](torrent[key])}
- ) - )} + ); + })}