X-Git-Url: http://these/git/?a=blobdiff_plain;f=server%2Fsrc%2Fapi%2Fcommunity.rs;fp=server%2Fsrc%2Fapi%2Fcommunity.rs;h=3fc67eb348f766905ea14e0b701bed2e9009a50d;hb=dc94e58cbf7e7de10d97331a3056380a3416e0b0;hp=cb412fccade6b45174f3a72b81fac99cd1064cb3;hpb=fd6a040568239d2e6949394fdc0ce0f7ac70275c;p=lemmy.git diff --git a/server/src/api/community.rs b/server/src/api/community.rs index cb412fcc..3fc67eb3 100644 --- a/server/src/api/community.rs +++ b/server/src/api/community.rs @@ -1,3 +1,4 @@ +use super::*; use crate::{ api::{APIError, Oper, Perform}, apub::{ @@ -6,19 +7,8 @@ use crate::{ ActorType, EndpointType, }, - db::{ - community::*, - community_view::*, - moderator::*, - site::*, - user::*, - user_view::*, - Bannable, - Crud, - Followable, - Joinable, - SortType, - }, + db::{Bannable, Crud, Followable, Joinable, SortType}, + is_valid_community_name, naive_from_unix, naive_now, slur_check, @@ -259,6 +249,10 @@ impl Perform for Oper { } } + if !is_valid_community_name(&data.name) { + return Err(APIError::err("invalid_community_name").into()); + } + let user_id = claims.id; let conn = pool.get()?; @@ -353,6 +347,10 @@ impl Perform for Oper { Err(_e) => return Err(APIError::err("not_logged_in").into()), }; + if !is_valid_community_name(&data.name) { + return Err(APIError::err("invalid_community_name").into()); + } + let user_id = claims.id; let conn = pool.get()?;