Throw specific Exception if Masterkey is not at the default location
And fix displaying those errors in local storage cloud because the enter password dialog was only partial present when this exception is thrown which leads to a nullpointer.
This commit is contained in:
parent
b32b76be32
commit
df57e01fce
@ -12,6 +12,7 @@ import org.cryptomator.domain.Vault;
|
||||
import org.cryptomator.domain.exception.BackendException;
|
||||
import org.cryptomator.domain.exception.CancellationException;
|
||||
import org.cryptomator.domain.exception.FatalBackendException;
|
||||
import org.cryptomator.domain.exception.vaultconfig.UnsupportedMasterkeyLocationException;
|
||||
import org.cryptomator.domain.repository.CloudContentRepository;
|
||||
import org.cryptomator.domain.usecases.cloud.ByteArrayDataSource;
|
||||
import org.cryptomator.domain.usecases.cloud.Flag;
|
||||
@ -161,8 +162,9 @@ public class MasterkeyCryptoCloudProvider implements CryptoCloudProvider {
|
||||
|
||||
private CloudFile masterkeyFile(CloudFolder vaultLocation, UnverifiedVaultConfig unverifiedVaultConfig) throws BackendException {
|
||||
String path = unverifiedVaultConfig.getKeyId().getSchemeSpecificPart();
|
||||
// TODO / FIXME sanitize path and throw specific exception
|
||||
//throw new UnsupportedMasterkeyLocationException(unverifiedVaultConfig);
|
||||
if(!path.equals(MASTERKEY_FILE_NAME)) {
|
||||
throw new UnsupportedMasterkeyLocationException(unverifiedVaultConfig);
|
||||
}
|
||||
return cloudContentRepository.file(vaultLocation, path);
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import org.cryptomator.domain.exception.license.NoLicenseAvailableException
|
||||
import org.cryptomator.domain.exception.update.GeneralUpdateErrorException
|
||||
import org.cryptomator.domain.exception.update.HashMismatchUpdateCheckException
|
||||
import org.cryptomator.domain.exception.update.SSLHandshakePreAndroid5UpdateCheckException
|
||||
import org.cryptomator.domain.exception.vaultconfig.UnsupportedMasterkeyLocationException
|
||||
import org.cryptomator.domain.exception.vaultconfig.VaultConfigLoadException
|
||||
import org.cryptomator.domain.exception.vaultconfig.VaultKeyInvalidException
|
||||
import org.cryptomator.domain.exception.vaultconfig.VaultVersionMismatchException
|
||||
@ -54,6 +55,7 @@ class ExceptionHandlers @Inject constructor(private val context: Context, defaul
|
||||
staticHandler(VaultVersionMismatchException::class.java, R.string.error_vault_version_mismatch)
|
||||
staticHandler(VaultKeyInvalidException::class.java, R.string.error_vault_key_invalid)
|
||||
staticHandler(VaultConfigLoadException::class.java, R.string.error_vault_config_loading)
|
||||
staticHandler(UnsupportedMasterkeyLocationException::class.java, R.string.error_masterkey_location_not_supported)
|
||||
staticHandler(NoSuchBucketException::class.java, R.string.error_no_such_bucket)
|
||||
exceptionHandlers.add(MissingCryptorExceptionHandler())
|
||||
exceptionHandlers.add(CancellationExceptionHandler())
|
||||
|
@ -107,8 +107,8 @@ class UnlockVaultPresenter @Inject constructor(
|
||||
}
|
||||
view?.showBiometricDialog(vaultModel)
|
||||
} else {
|
||||
startPrepareUnlockUseCase(vaultModel.toVault())
|
||||
view?.showEnterPasswordDialog(vaultModel)
|
||||
startPrepareUnlockUseCase(vaultModel.toVault())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
<string name="error_vault_config_loading">General error while loading the vault config</string>
|
||||
<string name="error_file_not_found_after_opening_using_3party">Local file isn\'t present anymore after switching back to Cryptomator. Possible changes cannot be propagated back to the cloud.</string>
|
||||
<string name="error_no_such_bucket">No such bucket</string>
|
||||
<string name="error_masterkey_location_not_supported">Custom Masterkey location not supported yet</string>
|
||||
|
||||
<!-- # clouds -->
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user