mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-31 01:30:00 +00:00
Only trim once.
This commit is contained in:
parent
194269fd3c
commit
8009251bf2
1 changed files with 3 additions and 2 deletions
|
@ -177,10 +177,11 @@ pub fn clean_url_params(mut url: Url) -> Url {
|
||||||
|
|
||||||
pub fn clean_optional_text(text: &Option<String>) -> Option<String> {
|
pub fn clean_optional_text(text: &Option<String>) -> Option<String> {
|
||||||
if let Some(text) = text {
|
if let Some(text) = text {
|
||||||
if text.trim().is_empty() {
|
let trimmed = text.trim();
|
||||||
|
if trimmed.is_empty() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(text.trim().to_owned())
|
Some(trimmed.to_owned())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
Loading…
Reference in a new issue