Percent encode remote interact URI

This commit is contained in:
Kitaiti Makoto 2021-02-14 22:59:01 +09:00
parent 703328601c
commit b7c7b6da9f
1 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,7 @@
use activitypub::collection::{OrderedCollection, OrderedCollectionPage};
use diesel::SaveChangesDsl;
use rocket::{
http::{ContentType, Cookies},
http::{uri::Uri, ContentType, Cookies},
request::LenientForm,
response::{status, Content, Flash, Redirect},
};
@ -134,7 +134,12 @@ pub fn follow_not_connected(
if let Some(remote_form) = remote_form {
if let Some(uri) = User::fetch_remote_interact_uri(&remote_form)
.ok()
.and_then(|uri| Some(uri.replace("{uri}", &target.acct_authority(&conn).ok()?)))
.and_then(|uri| {
Some(uri.replace(
"{uri}",
&Uri::percent_encode(&target.acct_authority(&conn).ok()?),
))
})
{
Ok(Redirect::to(uri).into())
} else {