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().
This commit is contained in:
Feross Aboukhadijeh
2016-09-30 15:48:03 -07:00
committed by DC
parent a38b5220ac
commit fd1a1f0f7e

View File

@@ -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()
}