diff options
author | ShadowNinja <shadowninja@minetest.net> | 2022-01-31 21:11:51 -0500 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2022-04-08 14:55:21 +0100 |
commit | dae6fe91a1059751a0bde504cdf41a749234ce1a (patch) | |
tree | 8fd07c915e6d682a21aa891f9eb2e7adbc71975a /src/unittest/test_utilities.cpp | |
parent | 65fdc7ae50adaee6116ed768d9f96e8732c96b85 (diff) | |
download | minetest-dae6fe91a1059751a0bde504cdf41a749234ce1a.tar.gz minetest-dae6fe91a1059751a0bde504cdf41a749234ce1a.tar.bz2 minetest-dae6fe91a1059751a0bde504cdf41a749234ce1a.zip |
Update directory name sanitization
Only ASCII spaces have to be handles specially, and leading spaces are
also disallowed.
Diffstat (limited to 'src/unittest/test_utilities.cpp')
-rw-r--r-- | src/unittest/test_utilities.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/unittest/test_utilities.cpp b/src/unittest/test_utilities.cpp index 228a9559f..10ea8d36a 100644 --- a/src/unittest/test_utilities.cpp +++ b/src/unittest/test_utilities.cpp @@ -636,8 +636,12 @@ void TestUtilities::testBase64() void TestUtilities::testSanitizeDirName() { - UASSERT(sanitizeDirName("a", "_") == "a"); - UASSERT(sanitizeDirName("COM1", "_") == "_COM1"); - UASSERT(sanitizeDirName("cOm\u00B2 .txt:a", "_") == "cOm\u00B2 _txt_a"); - UASSERT(sanitizeDirName("cOnIn$ ", "_") == "_cOnIn$ "); + UASSERT(sanitizeDirName("a", "~") == "a"); + UASSERT(sanitizeDirName(" ", "~") == "__"); + UASSERT(sanitizeDirName(" a ", "~") == "_a_"); + UASSERT(sanitizeDirName("COM1", "~") == "~COM1"); + UASSERT(sanitizeDirName("COM1", ":") == "_COM1"); + UASSERT(sanitizeDirName("cOm\u00B2", "~") == "~cOm\u00B2"); + UASSERT(sanitizeDirName("cOnIn$", "~") == "~cOnIn$"); + UASSERT(sanitizeDirName(" cOnIn$ ", "~") == "_cOnIn$_"); } |