Merge branch 'CrowCpp:master' into master

This commit is contained in:
Vhuynh25 2022-02-08 18:42:38 -05:00 committed by GitHub
commit 7672f3a0f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 3 deletions

View File

@ -632,7 +632,9 @@ namespace crow
inline std::string load_text(const std::string& filename)
{
return detail::get_loader_ref()(filename);
std::string filename_sanitized(filename);
utility::sanitize_filename(filename_sanitized);
return detail::get_loader_ref()(filename_sanitized);
}
inline template_t load(const std::string& filename)

View File

@ -694,7 +694,15 @@ namespace crow
}
else if ((c == '/') || (c == '\\'))
{
checkForSpecialEntries = true;
//TODO(EDev): uncomment below once #332 is merged
if (/*CROW_UNLIKELY(*/ i == 0 /*)*/) //Prevent Unix Absolute Paths (Windows Absolute Paths are prevented with `(c == ':')`)
{
data[i] = replacement;
}
else
{
checkForSpecialEntries = true;
}
}
}
}

View File

@ -2473,6 +2473,7 @@ TEST_CASE("sanitize_filename")
CHECK(sanitize_filename("abc/COM9") == "abc/_");
CHECK(sanitize_filename("abc/COM") == "abc/COM");
CHECK(sanitize_filename("abc/CON") == "abc/_");
CHECK(sanitize_filename("/abc/") == "_abc/");
}
TEST_CASE("get_port")

View File

@ -31,7 +31,7 @@
"version>=": "1.70.0"
},
{
"name": "openssl-windows"
"name": "openssl"
},
{
"name": "zlib"