From 0fbefe2cdc70ae2b81ac813d0622791b899960c6 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 7 Sep 2021 13:31:06 +0900 Subject: [PATCH] Percent-encode Post slug on sending Activity to other instances --- plume-models/src/posts.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index a66d47e2..afd251f8 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -17,7 +17,7 @@ use plume_common::{ inbox::{AsActor, AsObject, FromId}, Hashtag, Id, IntoId, Licensed, Source, PUBLIC_VISIBILITY, }, - utils::md_to_html, + utils::{iri_percent_encode_seg, md_to_html}, }; use riker::actors::{Publish, Tell}; use std::collections::{HashMap, HashSet}; @@ -249,7 +249,12 @@ impl Post { } pub fn ap_url(blog: Blog, slug: &str) -> String { - ap_url(&format!("{}/~/{}/{}/", CONFIG.base_url, blog.fqn, slug)) + ap_url(&format!( + "{}/~/{}/{}/", + CONFIG.base_url, + blog.fqn, + iri_percent_encode_seg(slug) + )) } // It's better to calc slug in insert and update