Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Change StartsWith overload (#144)

Leendert de Borst4dffb9c3c0e4
diff --git a/src/AliasVault.Client/Services/CredentialService.cs b/src/AliasVault.Client/Services/CredentialService.cs
index 3099c2636..7242bdf57 100644
--- a/src/AliasVault.Client/Services/CredentialService.cs
+++ b/src/AliasVault.Client/Services/CredentialService.cs
@@ -119,10 +119,10 @@ public sealed class CredentialService(HttpClient httpClient, DbService dbService
// Try to extract favicon from service URL
await ExtractFaviconAsync(loginObject);
- if (loginObject.Alias.Email is not null && loginObject.Alias.Email.StartsWith("@"))
+ // If the email starts with an @ it is most likely still the placeholder which hasn't been filled.
+ // So we remove it.
+ if (loginObject.Alias.Email is not null && loginObject.Alias.Email.StartsWith('@'))
{
- // If the email starts with an @ it is most likely still the placeholder which hasn't been filled.
- // So we remove it.
loginObject.Alias.Email = null;
}
@@ -195,10 +195,9 @@ public sealed class CredentialService(HttpClient httpClient, DbService dbService
throw new InvalidOperationException("Login object not found.");
}
- // Sanitize email address.
// If the email starts with an @ it is most likely still the placeholder which hasn't been filled.
// So we remove it.
- if (loginObject.Alias.Email is not null && loginObject.Alias.Email.StartsWith("@"))
+ if (loginObject.Alias.Email is not null && loginObject.Alias.Email.StartsWith('@'))
{
loginObject.Alias.Email = null;
}
diff --git a/src/AliasVault.Client/Services/Database/DbService.cs b/src/AliasVault.Client/Services/Database/DbService.cs
index 329da1ed0..9e3aa05eb 100644
--- a/src/AliasVault.Client/Services/Database/DbService.cs
+++ b/src/AliasVault.Client/Services/Database/DbService.cs
@@ -284,6 +284,25 @@ public sealed class DbService : IDisposable
GC.SuppressFinalize(this);
}
+ /// <summary>
+ /// Disposes the service.
+ /// </summary>
+ /// <param name="disposing">True if disposing.</param>
+ public void Dispose(bool disposing)
+ {
+ if (_disposed)
+ {
+ return;
+ }
+
+ if (disposing)
+ {
+ _sqlConnection.Dispose();
+ }
+
+ _disposed = true;
+ }
+
/// <summary>
/// Get a list of private email addresses that are used in aliases by this vault.
/// </summary>
@@ -307,25 +326,6 @@ public sealed class DbService : IDisposable
return emailAddresses;
}
- /// <summary>
- /// Disposes the service.
- /// </summary>
- /// <param name="disposing">True if disposing.</param>
- public void Dispose(bool disposing)
- {
- if (_disposed)
- {
- return;
- }
-
- if (disposing)
- {
- _sqlConnection.Dispose();
- }
-
- _disposed = true;
- }
-
/// <summary>
/// Loads a SQLite database from a base64 string which represents a .sqlite file.
/// </summary>