(web) fix add-by-URL regression in the nightlies

This commit is contained in:
Jordan Lee 2013-04-10 03:00:37 +00:00
parent c51132ad78
commit c3be9b9afc
1 changed files with 18 additions and 0 deletions

View File

@ -952,6 +952,24 @@ Transmission.prototype =
}
reader.readAsDataURL (file);
});
var url = $('#torrent_upload_url').val();
if (url != '') {
if (url.match(/^[0-9a-f]{40}$/i))
url = 'magnet:?xt=urn:btih:'+url;
var o = {
'method': 'torrent-add',
arguments: {
'paused': paused,
'download-dir': destination,
'filename': url
}
};
remote.sendRequest (o, function(response) {
if (response.result != 'success')
alert ('Error adding "' + file.name + '": ' + response.result);
});
}
}
},