From c1eb0861eb4dac01b00faf4c8a8bf580f6ad8f81 Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Wed, 24 Jun 2026 12:57:30 +0300 Subject: [PATCH] fix(e2ee): download key Signed-off-by: alperozturk96 --- .../dialog/setupEncryption/SetupEncryptionDialogFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/setupEncryption/SetupEncryptionDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/setupEncryption/SetupEncryptionDialogFragment.kt index 8b7a89158cf2..857b87bbfe62 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/setupEncryption/SetupEncryptionDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/setupEncryption/SetupEncryptionDialogFragment.kt @@ -41,6 +41,7 @@ import com.owncloud.android.utils.theme.ViewThemeUtils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import org.apache.commons.httpclient.HttpStatus import java.io.IOException import java.lang.ref.WeakReference import javax.inject.Inject @@ -309,11 +310,10 @@ class SetupEncryptionDialogFragment : val certificateOperation = GetPublicKeyRemoteOperation() val certificateResult = certificateOperation.executeNextcloudClient(user, weakContext) - val savedPrivateKey = dataProvider.getValue(user.accountName, EncryptionUtils.PRIVATE_KEY) if (!certificateResult.isSuccess) { // The certificate might not be available on the server yet. - // Therefore, the user needs to generate a new passphrase first. - return@withContext if (savedPrivateKey.isEmpty()) { + // Therefore, the user needs to generate a new passphrase first, send csr. + return@withContext if (certificateResult.httpCode == HttpStatus.SC_NOT_FOUND) { DownloadKeyResult.Success(null) } else { DownloadKeyResult.CertificateUnavailable()