From ee1e553460f02a0645eefa3ec7d703f64d3ed3a1 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 22:09:13 +0900 Subject: [PATCH 1/2] Fix a but about blog title and AP URL --- plume-models/src/blogs.rs | 13 ++++++++----- plume-models/src/posts.rs | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 489589a1..d9c35414 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -18,10 +18,13 @@ use openssl::{ rsa::Rsa, sign::{Signer, Verifier}, }; -use plume_common::activity_pub::{ - inbox::{AsActor, FromId}, - sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, SourceProperty, - ToAsString, ToAsUri, +use plume_common::{ + activity_pub::{ + inbox::{AsActor, FromId}, + sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, + SourceProperty, ToAsString, ToAsUri, + }, + utils::iri_percent_encode_seg, }; use webfinger::*; @@ -450,7 +453,7 @@ impl FromId for Blog { let any_base = AnyBase::from_extended(object)?; let id = any_base.id().ok_or(Error::MissingApProperty)?; - new_blog.ap_url = id.to_string(); + new_blog.ap_url = iri_percent_encode_seg(id.as_ref()); let inst = id .authority_components() diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 4d0748e0..74ff21d8 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -255,7 +255,7 @@ impl Post { ap_url(&format!( "{}/~/{}/{}/", CONFIG.base_url, - blog.fqn, + iri_percent_encode_seg(&blog.fqn), iri_percent_encode_seg(slug) )) } From 40e1a1fc2cbb29dd08accdea3c9e0b4d179ca18f Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Wed, 4 Jan 2023 17:48:31 +0900 Subject: [PATCH 2/2] Don't encode whole AP ID --- plume-models/src/blogs.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index d9c35414..489589a1 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -18,13 +18,10 @@ use openssl::{ rsa::Rsa, sign::{Signer, Verifier}, }; -use plume_common::{ - activity_pub::{ - inbox::{AsActor, FromId}, - sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, - SourceProperty, ToAsString, ToAsUri, - }, - utils::iri_percent_encode_seg, +use plume_common::activity_pub::{ + inbox::{AsActor, FromId}, + sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, SourceProperty, + ToAsString, ToAsUri, }; use webfinger::*; @@ -453,7 +450,7 @@ impl FromId for Blog { let any_base = AnyBase::from_extended(object)?; let id = any_base.id().ok_or(Error::MissingApProperty)?; - new_blog.ap_url = iri_percent_encode_seg(id.as_ref()); + new_blog.ap_url = id.to_string(); let inst = id .authority_components()