Refactor decryption logic to handle empty fields consistently across services

This commit is contained in:
natreex
2026-03-22 15:50:36 -04:00
parent 32d2b0fa5a
commit e8aaef108b
26 changed files with 226 additions and 120 deletions

View File

@@ -21,7 +21,7 @@ pub fn return_user_infos(conn: &Connection, user_id: &str, lang: Lang) -> AppRes
let username: String = decrypt_data_with_user_key(&user_infos_data.username, &user_encryption_key)?;
let email: String = decrypt_data_with_user_key(&user_infos_data.email, &user_encryption_key)?;
let author_name: String = if let Some(ref author_name_val) = user_infos_data.author_name { decrypt_data_with_user_key(author_name_val, &user_encryption_key)? } else { String::new() };
let author_name: String = if let Some(ref author_name_val) = user_infos_data.author_name { if author_name_val.is_empty() { String::new() } else { decrypt_data_with_user_key(author_name_val, &user_encryption_key)? } } else { String::new() };
Ok(UserInfoResponse {
id: user_id.to_string(),