fix issues from review

Co-authored-by: Clément Renault <clement@meilisearch.com>
This commit is contained in:
Quentin de Quelen 2020-05-07 17:01:14 +02:00 committed by qdequele
parent 305665cd42
commit b96da94f92
No known key found for this signature in database
GPG key ID: B3F0A000EBF11745
4 changed files with 7 additions and 6 deletions

View file

@ -2,6 +2,7 @@
/// This middleware normalizes slashes in paths
/// * consecutive instances of `/` get collapsed into one `/`
/// * any ending `/` is removed.
/// Original source from: https://gitlab.com/snippets/1884466
///
/// Ex:
/// /this///url/
@ -69,7 +70,7 @@ where
let path = match parts.path_and_query.as_ref().map(|pq| pq.query()).flatten() {
Some(q) => bytes::Bytes::from(format!("{}?{}", new_path, q)),
None =>bytes::Bytes::from(format!("{}", new_path))
None => bytes::Bytes::from(new_path.to_string()),
};
if let Ok(pq) = PathAndQuery::from_maybe_shared(path) {