From a8aeb40b957b9fa22aaf53070d29abe67a401232 Mon Sep 17 00:00:00 2001 From: Trinity Pointard Date: Tue, 22 May 2018 17:35:16 +0200 Subject: [PATCH] add trailing slashes to links where they were missing Signed-off-by: Trinity Pointard --- src/models/posts.rs | 2 +- src/routes/blogs.rs | 2 +- src/routes/posts.rs | 2 +- src/routes/user.rs | 6 +++--- templates/notifications/index.tera | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/models/posts.rs b/src/models/posts.rs index dcb94837..35f08b30 100644 --- a/src/models/posts.rs +++ b/src/models/posts.rs @@ -183,7 +183,7 @@ impl IntoId for Post { impl Object for Post { fn compute_id(&self, conn: &PgConnection) -> String { - ap_url(format!("{}/~/{}/{}", BASE_URL.as_str(), self.get_blog(conn).actor_id, self.slug)) + ap_url(format!("{}/~/{}/{}/", BASE_URL.as_str(), self.get_blog(conn).actor_id, self.slug)) } fn serialize(&self, conn: &PgConnection) -> serde_json::Value { diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 08fea83b..2df26cf5 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -77,7 +77,7 @@ fn create(conn: DbConn, data: Form, user: User) -> Redirect { is_owner: true }); - Redirect::to(format!("/~/{}", slug).as_str()) + Redirect::to(format!("/~/{}/", slug).as_str()) } #[get("/~//outbox")] diff --git a/src/routes/posts.rs b/src/routes/posts.rs index e213c869..61a917f4 100644 --- a/src/routes/posts.rs +++ b/src/routes/posts.rs @@ -96,5 +96,5 @@ fn create(blog_name: String, data: Form, user: User, conn: DbConn) let act = post.create_activity(&*conn); broadcast(&*conn, &user, act, user.get_followers(&*conn)); - Redirect::to(format!("/~/{}/{}", blog_name, slug).as_str()) + Redirect::to(format!("/~/{}/{}/", blog_name, slug).as_str()) } diff --git a/src/routes/user.rs b/src/routes/user.rs index 807168a8..6f4bb615 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -21,7 +21,7 @@ use models::{ #[get("/me")] fn me(user: User) -> Redirect { - Redirect::to(format!("/@/{}", user.username).as_ref()) + Redirect::to(format!("/@/{}/", user.username).as_ref()) } #[get("/@/", rank = 2)] @@ -64,7 +64,7 @@ fn follow(name: String, conn: DbConn, user: User) -> Redirect { act.set_object_object(user.into_activity(&*conn)).unwrap(); act.object_props.set_id_string(format!("{}/follow/{}", user.ap_url, target.ap_url)).unwrap(); broadcast(&*conn, &user, act, vec![target]); - Redirect::to(format!("/@/{}", name).as_ref()) + Redirect::to(format!("/@/{}/", name).as_ref()) } #[get("/@//followers", rank = 2)] @@ -155,7 +155,7 @@ fn create(conn: DbConn, data: Form) -> Result { User::hash_pass(form.password.to_string()), inst.id )).update_boxes(&*conn); - Ok(Redirect::to(format!("/@/{}", data.get().username).as_str())) + Ok(Redirect::to(format!("/@/{}/", data.get().username).as_str())) } else { Err(String::from("Passwords don't match")) } diff --git a/templates/notifications/index.tera b/templates/notifications/index.tera index 3af0de19..d25dedb0 100644 --- a/templates/notifications/index.tera +++ b/templates/notifications/index.tera @@ -9,7 +9,7 @@ Notifications