1
0
Fork 0
forked from alemi/upub

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
This commit is contained in:
əlemi 2024-05-13 15:07:58 +02:00
parent 4aff505a16
commit d5e01cc655
Signed by: alemi
GPG key ID: A4895B84D311642C
3 changed files with 4 additions and 5 deletions

1
Cargo.lock generated
View file

@ -4489,7 +4489,6 @@ dependencies = [
"tower-http",
"tracing",
"tracing-subscriber",
"url",
"uuid",
]

View file

@ -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

View file

@ -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)
}