Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
Loading