From a38b5220acb690b3efb22315e2982b626843da2d Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 30 Sep 2016 15:44:16 -0700 Subject: [PATCH] Trim extra spaces off pasted magnet links Before this change, using the "Open Torrent Address" dialog to paste a magnet link would fail with leading or trailing spaces. Pasting on the torrent list page has always trimmed. So this PR just makes it consistent. --- src/renderer/controllers/torrent-list-controller.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/renderer/controllers/torrent-list-controller.js b/src/renderer/controllers/torrent-list-controller.js index 89a13d7b..a625bb93 100644 --- a/src/renderer/controllers/torrent-list-controller.js +++ b/src/renderer/controllers/torrent-list-controller.js @@ -25,6 +25,11 @@ module.exports = class TorrentListController { torrentId = torrentId.path } + // Trim extra spaces off pasted magnet links + if (typeof torrentId === 'string') { + torrentId = torrentId.trim() + } + // Allow a instant.io link to be pasted if (typeof torrentId === 'string' && instantIoRegex.test(torrentId)) { torrentId = torrentId.slice(torrentId.indexOf('#') + 1)