improve handling of case where a torrent file has no files in it
This commit is contained in:
parent
5026659cb6
commit
33b03e1f8e
|
@ -1000,6 +1000,13 @@ namespace {
|
|||
}
|
||||
m_flags |= multifile;
|
||||
}
|
||||
if (files.num_files() == 0)
|
||||
{
|
||||
ec = errors::no_files_in_torrent;
|
||||
// mark the torrent as invalid
|
||||
m_files.set_piece_length(0);
|
||||
return false;
|
||||
}
|
||||
TORRENT_ASSERT(!files.name().empty());
|
||||
|
||||
// extract SHA-1 hashes for all pieces
|
||||
|
|
|
@ -155,6 +155,7 @@ test_failing_torrent_t test_error_torrents[] =
|
|||
{ "invalid_file_size.torrent", errors::torrent_invalid_length },
|
||||
{ "invalid_symlink.torrent", errors::torrent_invalid_name },
|
||||
{ "many_pieces.torrent", errors::too_many_pieces_in_torrent },
|
||||
{ "no_files.torrent", errors::no_files_in_torrent},
|
||||
};
|
||||
|
||||
// TODO: test remap_files
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
d10:created by10:libtorrent13:creation datei1359599503e4:infod5:filesle4:name4:temp12:piece lengthi16384e6:pieces20:‚ž¼Œ&¾ÇJW›}ÜA4u,·¼‘‡ee
|
Loading…
Reference in New Issue