From 9aac73ac4596b933b9fc97d1e0b0c0c2a2fdb226 Mon Sep 17 00:00:00 2001 From: Akbar Rahman Date: Fri, 30 Oct 2026 22:23:59 +0000 Subject: [PATCH] do not ignore query parameters --- readme.md | 4 ---- src/main.rs | 7 +------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/readme.md b/readme.md index f84905a..48857fd 100644 --- a/readme.md +++ b/readme.md @@ -63,10 +63,6 @@ for example, for the link the following line is in my urls. trailing slashes are ignored. -### query parameters are ignored - -anything after a question mark character (`?`) are ignored. - ## why? all url shorteners i've come across are too complicated: diff --git a/src/main.rs b/src/main.rs index 830ac34..fe61161 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,13 +13,8 @@ enum ResponseCode { NotFound, } -/// Remove query parameters and trailing slashes. -/// Makes all paths lowercase. fn normalise_path(path: &str) -> String { - let mut path = path - .split('?') - .next() - .expect("split operation returns at least one substring"); + let mut path = path; while path.len() > 1 && let Some('/') = path.chars().next_back() {