From bca870f1f8d0d23ac5fe16ed63e6f23023facd0a Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 3 Jan 2021 05:49:45 +0900 Subject: [PATCH] Percent encode URI for remote_interact --- src/routes/posts.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/posts.rs b/src/routes/posts.rs index 399a87f1..8a792df8 100644 --- a/src/routes/posts.rs +++ b/src/routes/posts.rs @@ -1,5 +1,6 @@ use chrono::Utc; use heck::KebabCase; +use rocket::http::uri::Uri; use rocket::request::LenientForm; use rocket::response::{Flash, Redirect}; use rocket_i18n::I18n; @@ -642,7 +643,7 @@ pub fn remote_interact_post( .and_then(|blog| Post::find_by_slug(&rockets.conn, &slug, blog.id))?; if let Some(uri) = User::fetch_remote_interact_uri(&remote.remote) .ok() - .map(|uri| uri.replace("{uri}", &target.ap_url)) + .map(|uri| uri.replace("{uri}", &Uri::percent_encode(&target.ap_url))) { Ok(Redirect::to(uri).into()) } else {