mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-23 00:00:15 +02:00
Fix URI captures matching empty segments (#264)
It was never the intention that `/:key` should match `/`. This fixes that. Part of https://github.com/tokio-rs/axum/issues/259
This commit is contained in:
+1
-1
@@ -762,7 +762,7 @@ impl PathPattern {
|
||||
if let Some(key) = part.strip_prefix(':') {
|
||||
capture_group_names.push(Bytes::copy_from_slice(key.as_bytes()));
|
||||
|
||||
Cow::Owned(format!("(?P<{}>[^/]*)", key))
|
||||
Cow::Owned(format!("(?P<{}>[^/]+)", key))
|
||||
} else {
|
||||
Cow::Borrowed(part)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user