Skip to content

Conversation

@The-EDev
Copy link
Member

This PR makes it so that the static directory can have either '/' or '\' in the path. It also allows the directory to not have any slash at the end.

Tested on Linux and Windows.

@crow-clang-format
Copy link

--- include/crow/app.h	(before formatting)
+++ include/crow/app.h	(after formatting)
@@ -283,7 +283,7 @@
                 std::string static_dir_(CROW_STATIC_DIRECTORY);
                 std::replace(static_dir_.begin(), static_dir_.end(), '\\', '/');
                 if (static_dir_[static_dir_.length() - 1] != '/')
-                  static_dir_ += '/';
+                    static_dir_ += '/';
 
                 route<crow::black_magic::get_parameter_tag(CROW_STATIC_ENDPOINT)>(CROW_STATIC_ENDPOINT)([static_dir_](crow::response& res, std::string file_path_partial) {
                     utility::sanitize_filename(file_path_partial);
@The-EDev The-EDev force-pushed the optional_static_dir_slash branch from 2def6a6 to 4e4dbec Compare July 25, 2022 10:56
@The-EDev The-EDev merged commit c4e810f into master Jul 25, 2022
@The-EDev The-EDev deleted the optional_static_dir_slash branch July 25, 2022 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants