Merge pull request #419 from joelguittet/feature/permit-crow-static-absolute-path

app: static can be an absolute path
This commit is contained in:
Farook Al-Sammarraie 2022-04-26 06:35:00 +03:00 committed by GitHub
commit 4f533c4bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,7 +239,8 @@ namespace crow
#ifndef CROW_DISABLE_STATIC_DIR
route<crow::black_magic::get_parameter_tag(CROW_STATIC_ENDPOINT)>(CROW_STATIC_ENDPOINT)([](crow::response& res, std::string file_path_partial) {
res.set_static_file_info(CROW_STATIC_DIRECTORY + file_path_partial);
utility::sanitize_filename(file_path_partial);
res.set_static_file_info_unsafe(CROW_STATIC_DIRECTORY + file_path_partial);
res.end();
});
@ -252,7 +253,8 @@ namespace crow
if (!bp->static_dir().empty())
{
bp->new_rule_tagged<crow::black_magic::get_parameter_tag(CROW_STATIC_ENDPOINT)>(CROW_STATIC_ENDPOINT)([bp](crow::response& res, std::string file_path_partial) {
res.set_static_file_info(bp->static_dir() + '/' + file_path_partial);
utility::sanitize_filename(file_path_partial);
res.set_static_file_info_unsafe(bp->static_dir() + '/' + file_path_partial);
res.end();
});
}