Merge pull request 'Percent encode URI for remote_interact' (#866) from encode-remote-interact into main

Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/866
This commit is contained in:
KitaitiMakoto 2021-01-02 21:28:27 +00:00
commit d0dd23a1af
2 changed files with 15 additions and 14 deletions

View File

@ -164,55 +164,55 @@ msgstr ""
msgid "To see your notifications, you need to be logged in" msgid "To see your notifications, you need to be logged in"
msgstr "" msgstr ""
# src/routes/posts.rs:54 # src/routes/posts.rs:55
msgid "This post isn't published yet." msgid "This post isn't published yet."
msgstr "" msgstr ""
# src/routes/posts.rs:125 # src/routes/posts.rs:126
msgid "To write a new post, you need to be logged in" msgid "To write a new post, you need to be logged in"
msgstr "" msgstr ""
# src/routes/posts.rs:142 # src/routes/posts.rs:143
msgid "You are not an author of this blog." msgid "You are not an author of this blog."
msgstr "" msgstr ""
# src/routes/posts.rs:149 # src/routes/posts.rs:150
msgid "New post" msgid "New post"
msgstr "" msgstr ""
# src/routes/posts.rs:194 # src/routes/posts.rs:195
msgid "Edit {0}" msgid "Edit {0}"
msgstr "" msgstr ""
# src/routes/posts.rs:263 # src/routes/posts.rs:264
msgid "You are not allowed to publish on this blog." msgid "You are not allowed to publish on this blog."
msgstr "" msgstr ""
# src/routes/posts.rs:355 # src/routes/posts.rs:356
msgid "Your article has been updated." msgid "Your article has been updated."
msgstr "" msgstr ""
# src/routes/posts.rs:542 # src/routes/posts.rs:543
msgid "Your article has been saved." msgid "Your article has been saved."
msgstr "" msgstr ""
# src/routes/posts.rs:549 # src/routes/posts.rs:550
msgid "New article" msgid "New article"
msgstr "" msgstr ""
# src/routes/posts.rs:582 # src/routes/posts.rs:583
msgid "You are not allowed to delete this article." msgid "You are not allowed to delete this article."
msgstr "" msgstr ""
# src/routes/posts.rs:607 # src/routes/posts.rs:608
msgid "Your article has been deleted." msgid "Your article has been deleted."
msgstr "" msgstr ""
# src/routes/posts.rs:612 # src/routes/posts.rs:613
msgid "It looks like the article you tried to delete doesn't exist. Maybe it is already gone?" msgid "It looks like the article you tried to delete doesn't exist. Maybe it is already gone?"
msgstr "" msgstr ""
# src/routes/posts.rs:652 # src/routes/posts.rs:653
msgid "Couldn't obtain enough information about your account. Please make sure your username is correct." msgid "Couldn't obtain enough information about your account. Please make sure your username is correct."
msgstr "" msgstr ""

View File

@ -1,5 +1,6 @@
use chrono::Utc; use chrono::Utc;
use heck::KebabCase; use heck::KebabCase;
use rocket::http::uri::Uri;
use rocket::request::LenientForm; use rocket::request::LenientForm;
use rocket::response::{Flash, Redirect}; use rocket::response::{Flash, Redirect};
use rocket_i18n::I18n; 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))?; .and_then(|blog| Post::find_by_slug(&rockets.conn, &slug, blog.id))?;
if let Some(uri) = User::fetch_remote_interact_uri(&remote.remote) if let Some(uri) = User::fetch_remote_interact_uri(&remote.remote)
.ok() .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()) Ok(Redirect::to(uri).into())
} else { } else {