mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Merge branch 'master' into my_dev
This commit is contained in:
commit
dfe180d5bd
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user