Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update email attachment content type handling (#2068)
Leendert de Borst7baf27038c1b
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.ktindex cf281680f..c836a565f 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@@ -283,9 +283,8 @@ class WebApiService(private val context: Context) {// Read response bodyval responseBody = try {- // Check if response is binary (octet-stream)- val contentType = connection.getHeaderField("Content-Type") ?: ""- val isBinary = contentType.contains("application/octet-stream", ignoreCase = true)+ val acceptHeader = headers.entries.firstOrNull { it.key.equals("Accept", ignoreCase = true) }?.value ?: ""+ val isBinary = acceptHeader.contains("application/octet-stream", ignoreCase = true)if (statusCode in 200..299) {if (isBinary) {diff --git a/apps/mobile-app/ios/VaultStoreKit/Services/WebApiService.swift b/apps/mobile-app/ios/VaultStoreKit/Services/WebApiService.swiftindex dad580db7..a7b7d4030 100644--- a/apps/mobile-app/ios/VaultStoreKit/Services/WebApiService.swift+++ b/apps/mobile-app/ios/VaultStoreKit/Services/WebApiService.swift@@ -246,9 +246,8 @@ public class WebApiService {}}- // Check if response is binary (octet-stream)- let contentType = responseHeaders["Content-Type"] ?? ""- let isBinary = contentType.lowercased().contains("application/octet-stream")+ let acceptHeader = headers.first { $0.key.caseInsensitiveCompare("Accept") == .orderedSame }?.value ?? ""+ let isBinary = acceptHeader.lowercased().contains("application/octet-stream")// Parse response bodylet responseBody: Stringdiff --git a/apps/server/AliasVault.Api/Controllers/Email/EmailController.cs b/apps/server/AliasVault.Api/Controllers/Email/EmailController.csindex 16a0085d8..03686dddc 100644--- a/apps/server/AliasVault.Api/Controllers/Email/EmailController.cs+++ b/apps/server/AliasVault.Api/Controllers/Email/EmailController.cs@@ -131,8 +131,9 @@ public class EmailController(ILogger<VaultController> logger, IAliasServerDbContreturn NotFound("Attachment not found.");}- // Return the encrypted bytes- return File(attachment.Bytes, attachment.MimeType, attachment.Filename);+ // Return the encrypted bytes as opaque binary. The original MIME type would be+ // misleading since the payload is AES ciphertext, not a renderable file.+ return File(attachment.Bytes, "application/octet-stream", attachment.Filename);}/// <summary>