fix add_torrent_impl when adding a URL (which has been deprecated) when building with deprecated features disabled (#733)

This commit is contained in:
Arvid Norberg 2016-05-17 16:49:11 -04:00
parent e8380e1d0b
commit eb72bbf2d2
2 changed files with 9 additions and 1 deletions

View File

@ -4811,7 +4811,7 @@ namespace aux {
if (string_begins_no_case("file://", params.url.c_str()) && !params.ti)
{
std::string filename = resolve_file_url(params.url);
std::string const filename = resolve_file_url(params.url);
boost::shared_ptr<torrent_info> t = boost::make_shared<torrent_info>(filename, boost::ref(ec), 0);
if (ec) return ptr_t();
params.url.clear();
@ -4866,6 +4866,12 @@ namespace aux {
}
#endif
if (params.info_hash == sha1_hash(0))
{
ec = errors::missing_info_hash_in_uri;
return ptr_t();
}
// is the torrent already active?
boost::shared_ptr<torrent> torrent_ptr = find_torrent(params.info_hash).lock();
#ifndef TORRENT_NO_DEPRECATE

View File

@ -64,10 +64,12 @@ TORRENT_TEST(remove_url)
test_remove_url("magnet:?xt=urn:btih:0123456789abcdef0123456789abcdef01234567");
}
#ifndef TORRENT_NO_DEPRECATE
TORRENT_TEST(remove_url2)
{
test_remove_url("http://non-existent.com/test.torrent");
}
#endif
TORRENT_TEST(magnet)
{