Skip to content

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

Update favicon extraction to properly detect nulls (#520)

Leendert de Borst3adc796295a9
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStorePasskey.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStorePasskey.kt
index bdb4b79dc..37c22d0d9 100644
--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStorePasskey.kt
+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/VaultStorePasskey.kt
@@ -238,23 +238,22 @@ fun VaultStore.createCredentialWithPasskey(
// Create a minimal service for the RP
val serviceId = UUID.randomUUID()
- val serviceInsert = """
- INSERT INTO Services (Id, Name, Url, Logo, CreatedAt, UpdatedAt, IsDeleted)
- VALUES (?, ?, ?, ?, ?, ?, ?)
- """.trimIndent()
- db.execSQL(
- serviceInsert,
- arrayOf(
- serviceId.toString().uppercase(),
- displayName,
- "https://$rpId",
- logo,
- timestamp,
- timestamp,
- 0,
- ),
- )
+ // Use ContentValues to properly handle BLOB type for logo
+ val serviceValues = android.content.ContentValues().apply {
+ put("Id", serviceId.toString().uppercase())
+ put("Name", displayName)
+ put("Url", "https://$rpId")
+ if (logo != null) {
+ put("Logo", logo) // ContentValues handles ByteArray -> BLOB correctly
+ } else {
+ putNull("Logo")
+ }
+ put("CreatedAt", timestamp)
+ put("UpdatedAt", timestamp)
+ put("IsDeleted", 0)
+ }
+ db.insert("Services", null, serviceValues)
// Create a minimal alias with empty fields and default birthdate
val aliasId = UUID.randomUUID()
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/webapi/WebApiService.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/webapi/WebApiService.kt
index d83eb7949..8dccee886 100644
--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/webapi/WebApiService.kt
+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/webapi/WebApiService.kt
@@ -338,9 +338,11 @@ class WebApiService(private val context: Context) {
// Parse response JSON
val responseObj = JSONObject(response.body)
- val imageBase64 = responseObj.optString("image")
- if (imageBase64.isEmpty()) {
- Log.w(TAG, "No image in favicon response")
+ val imageBase64 = responseObj.optString("image", "")
+
+ // Check if image is null, "null" string, or empty
+ if (imageBase64.isEmpty() || imageBase64 == "null" || responseObj.isNull("image")) {
+ Log.w(TAG, "No image in favicon response (received: '$imageBase64')")
return@withContext null
}