mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-19 06:04:40 +01:00
Remove a panic in normalize middleware (#1762)
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
This commit is contained in:
parent
32d59ca904
commit
7981e0068a
@ -3,6 +3,7 @@
|
|||||||
## Unreleased - 2020-xx-xx
|
## Unreleased - 2020-xx-xx
|
||||||
### Fixed
|
### Fixed
|
||||||
* Ensure `actix-http` dependency uses same `serde_urlencoded`.
|
* Ensure `actix-http` dependency uses same `serde_urlencoded`.
|
||||||
|
* Removed an occasional `unwrap` on `None` panic in `NormalizePathNormalization`.
|
||||||
|
|
||||||
|
|
||||||
## 3.3.0 - 2020-11-25
|
## 3.3.0 - 2020-11-25
|
||||||
|
@ -137,9 +137,9 @@ where
|
|||||||
// so the change can not be deduced from the length comparison
|
// so the change can not be deduced from the length comparison
|
||||||
if path != original_path {
|
if path != original_path {
|
||||||
let mut parts = head.uri.clone().into_parts();
|
let mut parts = head.uri.clone().into_parts();
|
||||||
let pq = parts.path_and_query.as_ref().unwrap();
|
let query = parts.path_and_query.as_ref().and_then(|pq| pq.query());
|
||||||
|
|
||||||
let path = if let Some(q) = pq.query() {
|
let path = if let Some(q) = query {
|
||||||
Bytes::from(format!("{}?{}", path, q))
|
Bytes::from(format!("{}?{}", path, q))
|
||||||
} else {
|
} else {
|
||||||
Bytes::copy_from_slice(path.as_bytes())
|
Bytes::copy_from_slice(path.as_bytes())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user