fix issue with symlink attributes

This commit is contained in:
Arvid Norberg 2014-06-18 06:20:12 +00:00
parent 5642a0bd59
commit b79dd1fee1
4 changed files with 16 additions and 2 deletions

View File

@ -425,12 +425,15 @@ namespace libtorrent
e.pad_file = (flags & pad_file) != 0;
e.hidden_attribute = (flags & attribute_hidden) != 0;
e.executable_attribute = (flags & attribute_executable) != 0;
e.symlink_attribute = (flags & attribute_symlink) != 0;
if (e.symlink_attribute && m_symlinks.size() < internal_file_entry::not_a_symlink - 1)
if ((flags & attribute_symlink) && m_symlinks.size() < internal_file_entry::not_a_symlink - 1)
{
e.symlink_attribute = 1;
e.symlink_index = m_symlinks.size();
m_symlinks.push_back(symlink_path);
}
else
e.symlink_attribute = 0;
if (mtime)
{
if (m_mtime.size() < m_files.size()) m_mtime.resize(m_files.size());

View File

@ -369,6 +369,10 @@ namespace libtorrent
target.symlink_path = combine_path(target.symlink_path, path_element);
}
}
else
{
target.symlink_attribute = false;
}
return true;
}
@ -1032,6 +1036,11 @@ namespace libtorrent
e.symlink_path = combine_path(e.symlink_path, path_element);
}
}
else
{
e.symlink_attribute = false;
}
lazy_entry const* fh = info.dict_find_string("sha1");
if (fh && fh->string_length() != 20) fh = 0;

View File

@ -74,6 +74,7 @@ test_torrent_t test_torrents[] =
{ "empty_path_multi.torrent" },
{ "duplicate_web_seeds.torrent" },
{ "invalid_name3.torrent" },
{ "symlink1.torrent" },
};
struct test_failing_torrent_t

View File

@ -0,0 +1 @@
d10:created by10:libtorrent13:creation datei1359599503e4:infod5:filesld6:lengthi425e4:pathl1:a1:b3:bareed4:attr1:l6:lengthi425e4:pathl1:a1:b3:fooeee4:name4:temp12:piece lengthi16384e6:pieces20:‚ž¼Œ&¾ÇJW}ÜA4u,·¼‡ee