aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-07 03:43:20 +0000
committerFuwn <[email protected]>2022-04-07 03:43:20 +0000
commit6e53a1d07bd6ce2f777627944bc1172c6611c124 (patch)
treef1797a4a25558c6d054d4bf36fb153da6744606c
parentdocs(cargo): bump version (diff)
downloadwindmark-6e53a1d07bd6ce2f777627944bc1172c6611c124.tar.xz
windmark-6e53a1d07bd6ce2f777627944bc1172c6611c124.zip
fix: try to fix path
-rw-r--r--Cargo.toml2
-rw-r--r--README.md6
-rw-r--r--examples/windmark.rs1
-rw-r--r--src/lib.rs11
4 files changed, 12 insertions, 8 deletions
diff --git a/Cargo.toml b/Cargo.toml
index b149d1a..e0fc6aa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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"
diff --git a/README.md b/README.md
index 5cd0674..9584317 100644
--- a/README.md
+++ b/README.md
@@ -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",
diff --git a/src/lib.rs b/src/lib.rs
index fcdd22b..f2a9269 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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()
};