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.
This commit is contained in:
Feross Aboukhadijeh
2016-09-30 15:44:16 -07:00
committed by DC
parent 428a07101a
commit a38b5220ac

View File

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