do not ignore query parameters
This commit is contained in:
@@ -63,10 +63,6 @@ for example, for the link <http://pls.cx/🤬> the following line is in my urls.
|
|||||||
|
|
||||||
trailing slashes are ignored.
|
trailing slashes are ignored.
|
||||||
|
|
||||||
### query parameters are ignored
|
|
||||||
|
|
||||||
anything after a question mark character (`?`) are ignored.
|
|
||||||
|
|
||||||
## why?
|
## why?
|
||||||
|
|
||||||
all url shorteners i've come across are too complicated:
|
all url shorteners i've come across are too complicated:
|
||||||
|
|||||||
+1
-6
@@ -13,13 +13,8 @@ enum ResponseCode {
|
|||||||
NotFound,
|
NotFound,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove query parameters and trailing slashes.
|
|
||||||
/// Makes all paths lowercase.
|
|
||||||
fn normalise_path(path: &str) -> String {
|
fn normalise_path(path: &str) -> String {
|
||||||
let mut path = path
|
let mut path = path;
|
||||||
.split('?')
|
|
||||||
.next()
|
|
||||||
.expect("split operation returns at least one substring");
|
|
||||||
while path.len() > 1
|
while path.len() > 1
|
||||||
&& let Some('/') = path.chars().next_back()
|
&& let Some('/') = path.chars().next_back()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user