Percent-encode Post slug on sending Activity to other instances

This commit is contained in:
Kitaiti Makoto 2021-09-07 13:31:06 +09:00
parent eedd5fe4e9
commit 0fbefe2cdc

View file

@ -17,7 +17,7 @@ use plume_common::{
inbox::{AsActor, AsObject, FromId}, inbox::{AsActor, AsObject, FromId},
Hashtag, Id, IntoId, Licensed, Source, PUBLIC_VISIBILITY, 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 riker::actors::{Publish, Tell};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
@ -249,7 +249,12 @@ impl Post {
} }
pub fn ap_url(blog: Blog, slug: &str) -> String { 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 // It's better to calc slug in insert and update