Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static directory slash fix #507

Merged
merged 2 commits into from
Jul 25, 2022
Merged

static directory slash fix #507

merged 2 commits into from
Jul 25, 2022

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 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants