From df9fa9ebad4ea557bfc622fe1e3d822da7303ca5 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Thu, 1 Jun 2017 23:52:23 +0200 Subject: [PATCH] Fixes #507 --- main/pom.xml | 4 ++-- .../ui/src/main/java/org/cryptomator/ui/model/Vault.java | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/main/pom.xml b/main/pom.xml index 745719e5d..d1f8131ed 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -27,8 +27,8 @@ UTF-8 - 1.1.1 - 1.2.3 + 1.1.2 + 1.3.0 0.6.1 1.0.2 1.7.25 diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java b/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java index c7c4c9224..0f7e89e91 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java +++ b/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java @@ -16,6 +16,7 @@ import java.nio.file.FileSystem; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.EnumSet; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; @@ -30,6 +31,7 @@ import org.cryptomator.common.settings.Settings; import org.cryptomator.common.settings.VaultSettings; import org.cryptomator.cryptofs.CryptoFileSystem; import org.cryptomator.cryptofs.CryptoFileSystemProperties; +import org.cryptomator.cryptofs.CryptoFileSystemProperties.FileSystemFlags; import org.cryptomator.cryptofs.CryptoFileSystemProvider; import org.cryptomator.cryptolib.api.CryptoException; import org.cryptomator.cryptolib.api.InvalidPassphraseException; @@ -79,12 +81,13 @@ public class Vault { // ********************************************************************************/ private CryptoFileSystem getCryptoFileSystem(CharSequence passphrase) throws IOException, CryptoException { - return LazyInitializer.initializeLazily(cryptoFileSystem, () -> createCryptoFileSystem(passphrase), IOException.class); + return LazyInitializer.initializeLazily(cryptoFileSystem, () -> unlockCryptoFileSystem(passphrase), IOException.class); } - private CryptoFileSystem createCryptoFileSystem(CharSequence passphrase) throws IOException, CryptoException { + private CryptoFileSystem unlockCryptoFileSystem(CharSequence passphrase) throws IOException, CryptoException { CryptoFileSystemProperties fsProps = CryptoFileSystemProperties.cryptoFileSystemProperties() // .withPassphrase(passphrase) // + .withFlags(EnumSet.noneOf(FileSystemFlags.class)) // TODO: use withFlags() with CryptoFS 1.3.1 .withMasterkeyFilename(MASTERKEY_FILENAME) // .build(); return CryptoFileSystemProvider.newFileSystem(getPath(), fsProps); @@ -99,7 +102,7 @@ public class Vault { } } if (!isValidVaultDirectory()) { - createCryptoFileSystem(passphrase).close(); // implicitly creates a non-existing vault + CryptoFileSystemProvider.initialize(getPath(), MASTERKEY_FILENAME, passphrase); } else { throw new FileAlreadyExistsException(getPath().toString()); }