We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2c7c6c0 commit 97544c6Copy full SHA for 97544c6
1 file changed
src/utils.rs
@@ -890,15 +890,10 @@ pub async fn parse_post(post: &Value) -> Post {
890
891
/// Grab a query parameter from a url
892
pub fn param(path: &str, value: &str) -> Option<String> {
893
- Some(
894
- Url::parse(format!("https://libredd.it/{path}").as_str())
895
- .ok()?
896
- .query_pairs()
897
- .into_owned()
898
- .collect::<HashMap<_, _>>()
899
- .get(value)?
900
- .clone(),
901
- )
+ let query = path.splitn(2, '?').nth(1).unwrap_or_default();
+ url::form_urlencoded::parse(query.as_bytes())
+ .find(|(k, _)| k == value)
+ .map(|(_, v)| v.into_owned())
902
}
903
904
/// Retrieve the value of a setting by name
0 commit comments