From d5e01cc65512908850d1407483c62f2bbdd157f9 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 13 May 2024 15:07:58 +0200 Subject: [PATCH] fix: urlencoding is too precise, just replace %20 omg i really chose such a bad way to do this i need to pick a proper one --- Cargo.lock | 1 - Cargo.toml | 1 - src/server/context.rs | 7 ++++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23d9c461..63ce31de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4489,7 +4489,6 @@ dependencies = [ "tower-http", "tracing", "tracing-subscriber", - "url", "uuid", ] diff --git a/Cargo.toml b/Cargo.toml index 6f39e33c..51887a2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,6 @@ mdhtml = { path = "mdhtml", features = ["markdown"] } jrd = "0.1" tracing = "0.1" tracing-subscriber = "0.3" -url = "2.5" clap = { version = "4.5", features = ["derive"] } futures = "0.3" tokio = { version = "1.35", features = ["full"] } # TODO slim this down diff --git a/src/server/context.rs b/src/server/context.rs index c2bf7f20..07c45f62 100644 --- a/src/server/context.rs +++ b/src/server/context.rs @@ -105,11 +105,12 @@ impl Context { if id.starts_with("http") { // ready-to-use id id } else if id.starts_with('+') { // compacted id - let reconstructed = id + // TODO theres already 2 edge cases, i really need to get rid of this + id .replace('@', "/") .replace("//", "/@") // oops my method sucks!! TODO - .replacen('+', "https://", 1); - url::form_urlencoded::byte_serialize(reconstructed.as_bytes()).collect() + .replacen('+', "https://", 1) + .replace(" ", "%20") // omg wordpress } else { // bare local id format!("{}{}/{}/{}", self.0.protocol, self.0.domain, entity, id) }