GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — static directory slash fix by The-EDev · Pull Request #507 · CrowCpp/Crow

Conversation

@The-EDev

@The-EDev The-EDev commented Jul 23, 2022

Copy link
Copy Markdown
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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@The-EDev
The-EDev requested review from luca-schlecker and mrozigor July 23, 2022 13:45
@crow-clang-format

crow-clang-format Bot commented Jul 23, 2022

Copy link
Copy Markdown
--- 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);
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mrozigor
mrozigor approved these changes Jul 25, 2022
View reviewed changes
The-EDev added 2 commits July 25, 2022 13:56
@The-EDev
made CROW_STATIC_DIRECTORY and BP static directory more versatile (on
5f22a65
win and linux)
@The-EDev
formatting
4e4dbec
@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

Reviewers

@mrozigor mrozigor mrozigor approved these changes
@luca-schlecker luca-schlecker Awaiting requested review from luca-schlecker

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@The-EDev @mrozigor
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.