diff --git a/src/file_storage.cpp b/src/file_storage.cpp index 49e7be21c..74eb5d598 100644 --- a/src/file_storage.cpp +++ b/src/file_storage.cpp @@ -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()); diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 2b1954c17..ec917d80a 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -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; diff --git a/test/test_torrent_parse.cpp b/test/test_torrent_parse.cpp index 09bfacf7e..6c246ee8a 100644 --- a/test/test_torrent_parse.cpp +++ b/test/test_torrent_parse.cpp @@ -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 diff --git a/test/test_torrents/symlink1.torrent b/test/test_torrents/symlink1.torrent new file mode 100644 index 000000000..3c3ddc3b0 --- /dev/null +++ b/test/test_torrents/symlink1.torrent @@ -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