diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index d6dc27fa2..76c10e572 100755 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -400,9 +400,7 @@ namespace libtorrent { if (i->first == "pieces" || i->first == "piece length" - || i->first == "length" -// || i->first == "files" - || i->first == "name") + || i->first == "length") continue; m_extra_info[i->first] = i->second; } diff --git a/test/test_primitives.cpp b/test/test_primitives.cpp index d328177a4..ba25c4a3c 100644 --- a/test/test_primitives.cpp +++ b/test/test_primitives.cpp @@ -3,6 +3,8 @@ #include "libtorrent/buffer.hpp" #include "libtorrent/xml_parse.hpp" #include "libtorrent/upnp.hpp" +#include "libtorrent/entry.hpp" +#include "libtorrent/torrent_info.hpp" #include #include #include @@ -185,6 +187,22 @@ int test_main() TEST_CHECK(is_local(address::from_string("192.168.0.1"))); TEST_CHECK(is_local(address::from_string("10.1.1.56"))); TEST_CHECK(!is_local(address::from_string("14.14.251.63"))); + + // test torrent parsing + + entry info; + info["pieces"] = "aaaaaaaaaaaaaaaaaaaa"; + info["name.utf-8"] = "test1"; + info["name"] = "test__"; + info["piece length"] = 16 * 1024; + info["length"] = 3245; + entry torrent; + torrent["info"] = info; + + torrent_info ti(torrent); + + TEST_CHECK(ti.name() == "test1"); + return 0; }