mirror of https://github.com/fafhrd91/actix-web
Remove a panic in normalize middleware
This commit is contained in:
parent
32d59ca904
commit
4f5b45317c
|
@ -30,6 +30,9 @@
|
||||||
* Re-export bytes::Buf{Mut} in web module. [#1750]
|
* Re-export bytes::Buf{Mut} in web module. [#1750]
|
||||||
* Upgrade `pin-project` to `1.0`.
|
* Upgrade `pin-project` to `1.0`.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* Removed an occasional `unwrap` on `None` panic in `NormalizePathNormalization`.
|
||||||
|
|
||||||
[#1723]: https://github.com/actix/actix-web/pull/1723
|
[#1723]: https://github.com/actix/actix-web/pull/1723
|
||||||
[#1743]: https://github.com/actix/actix-web/pull/1743
|
[#1743]: https://github.com/actix/actix-web/pull/1743
|
||||||
[#1748]: https://github.com/actix/actix-web/pull/1748
|
[#1748]: https://github.com/actix/actix-web/pull/1748
|
||||||
|
|
|
@ -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…
Reference in New Issue