From fd1a1f0f7e9a1b8086856722c1eb67c0478ea084 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 30 Sep 2016 15:48:03 -0700 Subject: [PATCH] On paste: Do not handle multiple newline separated torrent ids If the user accidentally pastes something that's not a torrent id, then they get one "Invalid torrent Id" error for each line of the text. Sure, this removes a "feature", but it's a pretty surprising one. When I added it, I was being too clever, IMO. The trim code can be removed, because that's handled in controllers.torrentList.addTorrent(). --- src/renderer/main.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/renderer/main.js b/src/renderer/main.js index 68555f47..2dc56f9c 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -428,14 +428,7 @@ function onError (err) { function onPaste (e) { if (e.target.tagName.toLowerCase() === 'input') return - - const torrentIds = electron.clipboard.readText().split('\n') - torrentIds.forEach(function (torrentId) { - torrentId = torrentId.trim() - if (torrentId.length === 0) return - controllers.torrentList.addTorrent(torrentId) - }) - + controllers.torrentList.addTorrent(electron.clipboard.readText()) update() }