From b7c7b6da9ffecbab63b19e280277516e83774c85 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 14 Feb 2021 22:59:01 +0900 Subject: [PATCH] Percent encode remote interact URI --- src/routes/user.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/routes/user.rs b/src/routes/user.rs index 2a8265b7..867c6a96 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -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 {