diff --git a/Cargo.lock b/Cargo.lock index 63ce31de..23d9c461 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4489,6 +4489,7 @@ dependencies = [ "tower-http", "tracing", "tracing-subscriber", + "url", "uuid", ] diff --git a/Cargo.toml b/Cargo.toml index 7b6fb614..6f39e33c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,10 +26,12 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" serde_default = "0.1" serde-inline-default = "0.2" +toml = "0.8" 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 @@ -46,7 +48,6 @@ sea-orm-migration = { version = "0.12", optional = true } mastodon-async-entities = { version = "1.1.0", optional = true } time = { version = "0.3", features = ["serde"], optional = true } async-recursion = "1.1" -toml = "0.8.12" [features] default = ["migrations", "cli"] diff --git a/src/server/context.rs b/src/server/context.rs index a9c2edff..c2bf7f20 100644 --- a/src/server/context.rs +++ b/src/server/context.rs @@ -105,10 +105,11 @@ impl Context { if id.starts_with("http") { // ready-to-use id id } else if id.starts_with('+') { // compacted id - id + let reconstructed = id .replace('@', "/") .replace("//", "/@") // oops my method sucks!! TODO - .replacen('+', "https://", 1) + .replacen('+', "https://", 1); + url::form_urlencoded::byte_serialize(reconstructed.as_bytes()).collect() } else { // bare local id format!("{}{}/{}/{}", self.0.protocol, self.0.domain, entity, id) }