diff --git a/Cargo.lock b/Cargo.lock
index 69b22f956..959aec106 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3655,9 +3655,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
-version = "2.2.0"
+version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e"
+checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b"
dependencies = [
"form_urlencoded",
"idna",
diff --git a/Cargo.toml b/Cargo.toml
index f76128cb4..e7d92fdf1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,7 +45,7 @@ actix-web = { version = "3.3.2", default-features = false, features = ["rustls"]
log = "0.4.14"
env_logger = "0.8.2"
strum = "0.20.0"
-url = { version = "2.2.0", features = ["serde"] }
+url = { version = "2.2.1", features = ["serde"] }
openssl = "0.10.32"
http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
tokio = "0.3.6"
diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml
index 5ab339584..ea3cd625c 100644
--- a/crates/api/Cargo.toml
+++ b/crates/api/Cargo.toml
@@ -32,7 +32,7 @@ rand = "0.8.3"
strum = "0.20.0"
strum_macros = "0.20.1"
lazy_static = "1.4.0"
-url = { version = "2.2.0", features = ["serde"] }
+url = { version = "2.2.1", features = ["serde"] }
openssl = "0.10.32"
http = "0.2.3"
http-signature-normalization-actix = { version = "0.4.1", default-features = false, features = ["sha-2"] }
diff --git a/crates/api/src/community.rs b/crates/api/src/community.rs
index 4bfbaeb4a..cee5d3710 100644
--- a/crates/api/src/community.rs
+++ b/crates/api/src/community.rs
@@ -1,6 +1,5 @@
use crate::{
check_community_ban,
- check_optional_url,
get_user_from_jwt,
get_user_from_jwt_opt,
is_admin,
@@ -19,7 +18,7 @@ use lemmy_apub::{
EndpointType,
};
use lemmy_db_queries::{
- diesel_option_overwrite,
+ diesel_option_overwrite_to_url,
source::{
comment::Comment_,
community::{CommunityModerator_, Community_},
@@ -155,11 +154,8 @@ impl Perform for CreateCommunity {
}
// Check to make sure the icon and banners are urls
- let icon = diesel_option_overwrite(&data.icon);
- let banner = diesel_option_overwrite(&data.banner);
-
- check_optional_url(&icon)?;
- check_optional_url(&banner)?;
+ let icon = diesel_option_overwrite_to_url(&data.icon)?;
+ let banner = diesel_option_overwrite_to_url(&data.banner)?;
// When you create a community, make sure the user becomes a moderator and a follower
let keypair = generate_actor_keypair()?;
@@ -260,11 +256,8 @@ impl Perform for EditCommunity {
})
.await??;
- let icon = diesel_option_overwrite(&data.icon);
- let banner = diesel_option_overwrite(&data.banner);
-
- check_optional_url(&icon)?;
- check_optional_url(&banner)?;
+ let icon = diesel_option_overwrite_to_url(&data.icon)?;
+ let banner = diesel_option_overwrite_to_url(&data.banner)?;
let community_form = CommunityForm {
name: read_community.name,
diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs
index 6f4ea8f4d..d87375ca7 100644
--- a/crates/api/src/lib.rs
+++ b/crates/api/src/lib.rs
@@ -186,15 +186,6 @@ pub(crate) async fn collect_moderated_communities(
}
}
-pub(crate) fn check_optional_url(item: &Option