let icon = diesel_option_overwrite(&data.icon);
let banner = diesel_option_overwrite(&data.banner);
- check_optional_url(&data.icon)?;
- check_optional_url(&data.banner)?;
+ check_optional_url(&icon)?;
+ check_optional_url(&banner)?;
// When you create a community, make sure the user becomes a moderator and a follower
let keypair = generate_actor_keypair()?;
let icon = diesel_option_overwrite(&data.icon);
let banner = diesel_option_overwrite(&data.banner);
- check_optional_url(&data.icon)?;
- check_optional_url(&data.banner)?;
+ check_optional_url(&icon)?;
+ check_optional_url(&banner)?;
let community_form = CommunityForm {
name: read_community.name,
}
}
-pub(in crate) fn check_optional_url(item: &Option<String>) -> Result<(), LemmyError> {
- if let Some(item) = &item {
+pub(in crate) fn check_optional_url(item: &Option<Option<String>>) -> Result<(), LemmyError> {
+ if let Some(Some(item)) = &item {
if Url::parse(item).is_err() {
return Err(APIError::err("invalid_url").into());
}
check_community_ban(user.id, data.community_id, context.pool()).await?;
- check_optional_url(&data.url)?;
+ check_optional_url(&Some(data.url.to_owned()))?;
// Fetch Iframely and pictrs cached image
let (iframely_title, iframely_description, iframely_html, pictrs_thumbnail) =
let matrix_user_id = diesel_option_overwrite(&data.matrix_user_id);
// Check to make sure the avatar and banners are urls
- check_optional_url(&data.avatar)?;
- check_optional_url(&data.banner)?;
+ check_optional_url(&avatar)?;
+ check_optional_url(&banner)?;
if let Some(Some(bio)) = &bio {
if bio.chars().count() > 300 {