diff options
| author | Fuwn <[email protected]> | 2022-04-07 03:43:20 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-07 03:43:20 +0000 |
| commit | 6e53a1d07bd6ce2f777627944bc1172c6611c124 (patch) | |
| tree | f1797a4a25558c6d054d4bf36fb153da6744606c | |
| parent | docs(cargo): bump version (diff) | |
| download | windmark-6e53a1d07bd6ce2f777627944bc1172c6611c124.tar.xz windmark-6e53a1d07bd6ce2f777627944bc1172c6611c124.zip | |
fix: try to fix path
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | examples/windmark.rs | 1 | ||||
| -rw-r--r-- | src/lib.rs | 11 |
4 files changed, 12 insertions, 8 deletions
@@ -2,7 +2,7 @@ [package] name = "windmark" -version = "0.1.10" +version = "0.1.11" authors = ["Fuwn <[email protected]>"] edition = "2021" description = "An elegant and highly performant async Gemini server framework" @@ -15,15 +15,15 @@ the modern age! # Cargo.toml [dependencies] -windmark = "0.1.10" +windmark = "0.1.11" tokio = { version = "0.2.4", features = ["full"] } # If you would like to use the built-in logger (recommended) -# windmark = { version = "0.1.10", features = ["logger"] } +# windmark = { version = "0.1.11", features = ["logger"] } # If you would like to use the built-in MIME dedection when `Success`-ing a file # (recommended) -# windmark = { version = "0.1.10", features = ["auto-deduce-mime"] } +# windmark = { version = "0.1.11", features = ["auto-deduce-mime"] } ``` ### Implement a Windmark server diff --git a/examples/windmark.rs b/examples/windmark.rs index 709c552..2a0f682 100644 --- a/examples/windmark.rs +++ b/examples/windmark.rs @@ -66,6 +66,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { Response::PermanentFailure("e".into()) })); + router.set_fix_path(true); router.attach_stateless(|r| { r.mount( "/module", @@ -33,15 +33,15 @@ //! # Cargo.toml //! //! [dependencies] -//! windmark = "0.1.10" +//! windmark = "0.1.11" //! tokio = { version = "0.2.4", features = ["full"] } //! //! # If you would like to use the built-in logger (recommended) -//! # windmark = { version = "0.1.10", features = ["logger"] } +//! # windmark = { version = "0.1.11", features = ["logger"] } //! //! # If you would like to use the built-in MIME dedection when `Success`-ing a file //! # (recommended) -//! # windmark = { version = "0.1.10", features = ["auto-deduce-mime"] } +//! # windmark = { version = "0.1.11", features = ["auto-deduce-mime"] } //! ``` //! //! ### Implement a Windmark server @@ -363,7 +363,10 @@ impl Router { } let fixed_path = if self.fix_path { - self.routes.fix_path(url.path()).unwrap() + self + .routes + .fix_path(url.path()) + .unwrap_or_else(|| url.path().to_string()) } else { url.path().to_string() }; |