diff --git a/ChangeLog b/ChangeLog index aefc6bc1f..3cc012b98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ + * restore path sanitization behavior of ":" * fix listen socket issue when disabling "force_proxy" mode * fix full allocation failure on APFS diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index b83043725..8deb076af 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -103,11 +103,7 @@ namespace libtorrent static const boost::array bad_cp = {{0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0x200e, 0x200f}}; if (std::find(bad_cp.begin(), bad_cp.end(), c) != bad_cp.end()) return true; -#ifdef TORRENT_WINDOWS - static const char invalid_chars[] = "/\\:"; -#else static const char invalid_chars[] = "/\\"; -#endif if (c > 127) return false; return std::strchr(invalid_chars, static_cast(c)) != NULL; } diff --git a/test/test_torrent_info.cpp b/test/test_torrent_info.cpp index 8d3b4966b..37ce96379 100644 --- a/test/test_torrent_info.cpp +++ b/test/test_torrent_info.cpp @@ -362,7 +362,7 @@ TORRENT_TEST(sanitize_path) path.clear(); sanitize_append_path_element(path, "dev:", 4); #ifdef TORRENT_WINDOWS - TEST_EQUAL(path, "dev"); + TEST_EQUAL(path, "dev_"); #else TEST_EQUAL(path, "dev:"); #endif @@ -371,7 +371,7 @@ TORRENT_TEST(sanitize_path) sanitize_append_path_element(path, "c:", 2); sanitize_append_path_element(path, "b", 1); #ifdef TORRENT_WINDOWS - TEST_EQUAL(path, "c" SEPARATOR "b"); + TEST_EQUAL(path, "c_" SEPARATOR "b"); #else TEST_EQUAL(path, "c:" SEPARATOR "b"); #endif @@ -381,7 +381,7 @@ TORRENT_TEST(sanitize_path) sanitize_append_path_element(path, ".", 1); sanitize_append_path_element(path, "c", 1); #ifdef TORRENT_WINDOWS - TEST_EQUAL(path, "c" SEPARATOR "c"); + TEST_EQUAL(path, "c_" SEPARATOR "c"); #else TEST_EQUAL(path, "c:" SEPARATOR "c"); #endif @@ -524,6 +524,17 @@ TORRENT_TEST(sanitize_path_zeroes) TEST_EQUAL(path, ""); } +TORRENT_TEST(sanitize_path_colon) +{ + std::string path; + sanitize_append_path_element(path, "foo:bar", 7); +#ifdef TORRENT_WINDOWS + TEST_EQUAL(path, "foo_bar"); +#else + TEST_EQUAL(path, "foo:bar"); +#endif +} + TORRENT_TEST(verify_encoding) { // verify_encoding @@ -643,7 +654,7 @@ TORRENT_TEST(parse_torrents) torrent_info ti2(&buf[0], buf.size(), ec); std::cerr << ti2.name() << std::endl; #ifdef TORRENT_WINDOWS - TEST_EQUAL(ti2.name(), "ctest1test2test3"); + TEST_EQUAL(ti2.name(), "c_test1test2test3"); #else TEST_EQUAL(ti2.name(), "test1test2test3"); #endif