diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index d6a3de953..1c7121872 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -32,9 +32,9 @@
+
-
diff --git a/.idea/runConfigurations/Cryptomator_macOS.xml b/.idea/runConfigurations/Cryptomator_macOS.xml
index 3d824a536..235887653 100644
--- a/.idea/runConfigurations/Cryptomator_macOS.xml
+++ b/.idea/runConfigurations/Cryptomator_macOS.xml
@@ -1,5 +1,8 @@
+
+
+
diff --git a/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettings.java b/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettings.java
index 3d91b38f7..04dd2b447 100644
--- a/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettings.java
+++ b/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettings.java
@@ -9,23 +9,20 @@ import com.google.common.base.Strings;
import com.google.common.io.BaseEncoding;
import javafx.beans.Observable;
import javafx.beans.property.BooleanProperty;
+import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
+import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import org.apache.commons.lang3.StringUtils;
import org.fxmisc.easybind.EasyBind;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
-import java.util.Base64;
-import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Random;
-import java.util.UUID;
/**
* The settings specific to a single vault.
@@ -38,6 +35,7 @@ public class VaultSettings {
public static final boolean DEFAULT_USES_INDIVIDUAL_MOUNTPATH = false;
public static final boolean DEFAULT_USES_READONLY_MODE = false;
public static final String DEFAULT_MOUNT_FLAGS = "";
+ public static final int DEFAULT_FILENAME_LENGTH_LIMIT = -1;
private static final Random RNG = new Random();
@@ -51,6 +49,7 @@ public class VaultSettings {
private final StringProperty individualMountPath = new SimpleStringProperty();
private final BooleanProperty usesReadOnlyMode = new SimpleBooleanProperty(DEFAULT_USES_READONLY_MODE);
private final StringProperty mountFlags = new SimpleStringProperty(DEFAULT_MOUNT_FLAGS);
+ private final IntegerProperty filenameLengthLimit = new SimpleIntegerProperty(DEFAULT_FILENAME_LENGTH_LIMIT);
public VaultSettings(String id) {
this.id = Objects.requireNonNull(id);
@@ -59,7 +58,7 @@ public class VaultSettings {
}
Observable[] observables() {
- return new Observable[]{path, mountName, winDriveLetter, unlockAfterStartup, revealAfterMount, usesIndividualMountPath, individualMountPath, usesReadOnlyMode, mountFlags};
+ return new Observable[]{path, mountName, winDriveLetter, unlockAfterStartup, revealAfterMount, usesIndividualMountPath, individualMountPath, usesReadOnlyMode, mountFlags, filenameLengthLimit};
}
private void deriveMountNameFromPath(Path path) {
@@ -146,6 +145,10 @@ public class VaultSettings {
public StringProperty mountFlags() {
return mountFlags;
}
+
+ public IntegerProperty filenameLengthLimit() {
+ return filenameLengthLimit;
+ }
/* Hashcode/Equals */
diff --git a/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettingsJsonAdapter.java b/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettingsJsonAdapter.java
index e5130cdb0..8e87a16e7 100644
--- a/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettingsJsonAdapter.java
+++ b/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettingsJsonAdapter.java
@@ -29,6 +29,7 @@ class VaultSettingsJsonAdapter {
out.name("individualMountPath").value(value.individualMountPath().get());
out.name("usesReadOnlyMode").value(value.usesReadOnlyMode().get());
out.name("mountFlags").value(value.mountFlags().get());
+ out.name("filenameLengthLimit").value(value.filenameLengthLimit().get());
out.endObject();
}
@@ -43,6 +44,7 @@ class VaultSettingsJsonAdapter {
boolean usesIndividualMountPath = VaultSettings.DEFAULT_USES_INDIVIDUAL_MOUNTPATH;
boolean usesReadOnlyMode = VaultSettings.DEFAULT_USES_READONLY_MODE;
String mountFlags = VaultSettings.DEFAULT_MOUNT_FLAGS;
+ int filenameLengthLimit = VaultSettings.DEFAULT_FILENAME_LENGTH_LIMIT;
in.beginObject();
while (in.hasNext()) {
@@ -78,6 +80,9 @@ class VaultSettingsJsonAdapter {
case "mountFlags":
mountFlags = in.nextString();
break;
+ case "filenameLengthLimit":
+ filenameLengthLimit = in.nextInt();
+ break;
default:
LOG.warn("Unsupported vault setting found in JSON: " + name);
in.skipValue();
@@ -96,6 +101,7 @@ class VaultSettingsJsonAdapter {
vaultSettings.individualMountPath().set(individualMountPath);
vaultSettings.usesReadOnlyMode().set(usesReadOnlyMode);
vaultSettings.mountFlags().set(mountFlags);
+ vaultSettings.filenameLengthLimit().set(filenameLengthLimit);
return vaultSettings;
}
diff --git a/main/commons/src/main/java/org/cryptomator/common/vaults/Vault.java b/main/commons/src/main/java/org/cryptomator/common/vaults/Vault.java
index e9e0fbd6d..5b0fd3bd6 100644
--- a/main/commons/src/main/java/org/cryptomator/common/vaults/Vault.java
+++ b/main/commons/src/main/java/org/cryptomator/common/vaults/Vault.java
@@ -21,6 +21,8 @@ import org.cryptomator.cryptofs.CryptoFileSystem;
import org.cryptomator.cryptofs.CryptoFileSystemProperties;
import org.cryptomator.cryptofs.CryptoFileSystemProperties.FileSystemFlags;
import org.cryptomator.cryptofs.CryptoFileSystemProvider;
+import org.cryptomator.cryptofs.common.Constants;
+import org.cryptomator.cryptofs.common.FileSystemCapabilityChecker;
import org.cryptomator.cryptolib.api.CryptoException;
import org.cryptomator.cryptolib.api.InvalidPassphraseException;
import org.slf4j.Logger;
@@ -101,10 +103,19 @@ public class Vault {
if (vaultSettings.usesReadOnlyMode().get()) {
flags.add(FileSystemFlags.READONLY);
}
+ if (vaultSettings.filenameLengthLimit().get() == -1) {
+ LOG.debug("Determining file name length limitations...");
+ int limit = new FileSystemCapabilityChecker().determineSupportedFileNameLength(getPath());
+ vaultSettings.filenameLengthLimit().set(limit);
+ LOG.info("Storing file name length limit of {}", limit);
+ }
+ assert vaultSettings.filenameLengthLimit().get() > 0;
CryptoFileSystemProperties fsProps = CryptoFileSystemProperties.cryptoFileSystemProperties() //
.withPassphrase(passphrase) //
.withFlags(flags) //
.withMasterkeyFilename(MASTERKEY_FILENAME) //
+ .withMaxPathLength(vaultSettings.filenameLengthLimit().get() + Constants.MAX_ADDITIONAL_PATH_LENGTH) //
+ .withMaxNameLength(vaultSettings.filenameLengthLimit().get()) //
.build();
return CryptoFileSystemProvider.newFileSystem(getPath(), fsProps);
}
diff --git a/main/pom.xml b/main/pom.xml
index 917d930a3..7926fdf22 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -24,11 +24,11 @@
UTF-8
- 1.9.7
+ 1.9.9
2.2.2
1.2.3
- 1.1.13
- 1.0.10
+ 1.1.14
+ 1.0.11
14
diff --git a/main/ui/src/main/java/org/cryptomator/ui/common/FxmlFile.java b/main/ui/src/main/java/org/cryptomator/ui/common/FxmlFile.java
index 9798a9a0f..262af2283 100644
--- a/main/ui/src/main/java/org/cryptomator/ui/common/FxmlFile.java
+++ b/main/ui/src/main/java/org/cryptomator/ui/common/FxmlFile.java
@@ -13,6 +13,7 @@ public enum FxmlFile {
FORGET_PASSWORD("/fxml/forget_password.fxml"), //
MAIN_WINDOW("/fxml/main_window.fxml"), //
MIGRATION_CAPABILITY_ERROR("/fxml/migration_capability_error.fxml"), //
+ MIGRATION_IMPOSSIBLE("/fxml/migration_impossible.fxml"),
MIGRATION_RUN("/fxml/migration_run.fxml"), //
MIGRATION_START("/fxml/migration_start.fxml"), //
MIGRATION_SUCCESS("/fxml/migration_success.fxml"), //
diff --git a/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationImpossibleController.java b/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationImpossibleController.java
new file mode 100644
index 000000000..76d462113
--- /dev/null
+++ b/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationImpossibleController.java
@@ -0,0 +1,46 @@
+package org.cryptomator.ui.migration;
+
+import javafx.fxml.FXML;
+import javafx.stage.Stage;
+import org.cryptomator.common.vaults.Vault;
+import org.cryptomator.ui.common.FxController;
+import org.cryptomator.ui.fxapp.FxApplication;
+
+import javax.inject.Inject;
+
+public class MigrationImpossibleController implements FxController {
+
+ private static final String HELP_URI = "https://docs.cryptomator.org/en/1.5/help/manual-migration/";
+
+ private final FxApplication fxApplication;
+ private final Stage window;
+ private final Vault vault;
+
+ @Inject
+ MigrationImpossibleController(FxApplication fxApplication, @MigrationWindow Stage window, @MigrationWindow Vault vault) {
+ this.fxApplication = fxApplication;
+ this.window = window;
+ this.vault = vault;
+ }
+
+ @FXML
+ public void close() {
+ window.close();
+ }
+
+ @FXML
+ public void getMigrationHelp() {
+ fxApplication.getHostServices().showDocument(HELP_URI);
+ }
+
+ /* Getter/Setters */
+
+ public Vault getVault() {
+ return vault;
+ }
+
+ public String getHelpUri() {
+ return HELP_URI;
+ }
+
+}
diff --git a/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationModule.java b/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationModule.java
index 508777364..0c36818a2 100644
--- a/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationModule.java
+++ b/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationModule.java
@@ -83,6 +83,13 @@ abstract class MigrationModule {
return fxmlLoaders.createScene("/fxml/migration_capability_error.fxml");
}
+ @Provides
+ @FxmlScene(FxmlFile.MIGRATION_IMPOSSIBLE)
+ @MigrationScoped
+ static Scene provideMigrationImpossibleScene(@MigrationWindow FXMLLoaderFactory fxmlLoaders) {
+ return fxmlLoaders.createScene("/fxml/migration_impossible.fxml");
+ }
+
// ------------------
@Binds
@@ -104,5 +111,9 @@ abstract class MigrationModule {
@IntoMap
@FxControllerKey(MigrationCapabilityErrorController.class)
abstract FxController bindMigrationCapabilityErrorController(MigrationCapabilityErrorController controller);
-
+
+ @Binds
+ @IntoMap
+ @FxControllerKey(MigrationImpossibleController.class)
+ abstract FxController bindMigrationImpossibleController(MigrationImpossibleController controller);
}
diff --git a/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java b/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java
index 08cba8b5c..aad1914d7 100644
--- a/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java
+++ b/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java
@@ -16,8 +16,10 @@ import javafx.scene.control.ContentDisplay;
import javafx.stage.Stage;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.common.vaults.VaultState;
+import org.cryptomator.cryptofs.FileNameTooLongException;
import org.cryptomator.cryptofs.common.FileSystemCapabilityChecker;
import org.cryptomator.cryptofs.migration.Migrators;
+import org.cryptomator.cryptofs.migration.api.MigrationContinuationListener;
import org.cryptomator.cryptofs.migration.api.MigrationProgressListener;
import org.cryptomator.cryptolib.api.InvalidPassphraseException;
import org.cryptomator.keychain.KeychainAccess;
@@ -58,6 +60,7 @@ public class MigrationRunController implements FxController {
private final ErrorComponent.Builder errorComponent;
private final Lazy startScene;
private final Lazy successScene;
+ private final Lazy impossibleScene;
private final ObjectBinding migrateButtonContentDisplay;
private final Lazy capabilityErrorScene;
private final BooleanProperty migrationButtonDisabled;
@@ -66,7 +69,8 @@ public class MigrationRunController implements FxController {
public NiceSecurePasswordField passwordField;
@Inject
- public MigrationRunController(@MigrationWindow Stage window, @MigrationWindow Vault vault, ExecutorService executor, ScheduledExecutorService scheduler, Optional keychainAccess, @Named("capabilityErrorCause") ObjectProperty missingCapability, @FxmlScene(FxmlFile.MIGRATION_START) Lazy startScene, @FxmlScene(FxmlFile.MIGRATION_SUCCESS) Lazy successScene, @FxmlScene(FxmlFile.MIGRATION_CAPABILITY_ERROR) Lazy capabilityErrorScene, ErrorComponent.Builder errorComponent) {
+ public MigrationRunController(@MigrationWindow Stage window, @MigrationWindow Vault vault, ExecutorService executor, ScheduledExecutorService scheduler, Optional keychainAccess, @Named("capabilityErrorCause") ObjectProperty missingCapability, @FxmlScene(FxmlFile.MIGRATION_START) Lazy startScene, @FxmlScene(FxmlFile.MIGRATION_SUCCESS) Lazy successScene, @FxmlScene(FxmlFile.MIGRATION_CAPABILITY_ERROR) Lazy capabilityErrorScene, @FxmlScene(FxmlFile.MIGRATION_IMPOSSIBLE) Lazy impossibleScene, ErrorComponent.Builder errorComponent) {
+
this.window = window;
this.vault = vault;
this.executor = executor;
@@ -80,6 +84,7 @@ public class MigrationRunController implements FxController {
this.capabilityErrorScene = capabilityErrorScene;
this.migrationButtonDisabled = new SimpleBooleanProperty();
this.migrationProgress = new SimpleDoubleProperty(volatileMigrationProgress);
+ this.impossibleScene = impossibleScene;
}
public void initialize() {
@@ -107,7 +112,7 @@ public class MigrationRunController implements FxController {
}, 0, MIGRATION_PROGRESS_UPDATE_MILLIS, TimeUnit.MILLISECONDS);
Tasks.create(() -> {
Migrators migrators = Migrators.get();
- migrators.migrate(vault.getPath(), MASTERKEY_FILENAME, password, this::migrationProgressChanged);
+ migrators.migrate(vault.getPath(), MASTERKEY_FILENAME, password, this::migrationProgressChanged, this::migrationRequiresInput);
return migrators.needsMigration(vault.getPath(), MASTERKEY_FILENAME);
}).onSuccess(needsAnotherMigration -> {
if (needsAnotherMigration) {
@@ -127,9 +132,14 @@ public class MigrationRunController implements FxController {
vault.setState(VaultState.NEEDS_MIGRATION);
}).onError(FileSystemCapabilityChecker.MissingCapabilityException.class, e -> {
LOG.error("Underlying file system not supported.", e);
- vault.setState(VaultState.ERROR);
+ vault.setState(VaultState.NEEDS_MIGRATION);
missingCapability.set(e.getMissingCapability());
window.setScene(capabilityErrorScene.get());
+ }).onError(FileNameTooLongException.class, e -> {
+ LOG.error("Migration failed because the underlying file system does not support long filenames.", e);
+ vault.setState(VaultState.NEEDS_MIGRATION);
+ errorComponent.cause(e).window(window).returnToScene(startScene.get()).build().showErrorScene();
+ window.setScene(impossibleScene.get());
}).onError(Exception.class, e -> { // including RuntimeExceptions
LOG.error("Migration failed for technical reasons.", e);
vault.setState(VaultState.NEEDS_MIGRATION);
@@ -149,6 +159,13 @@ public class MigrationRunController implements FxController {
};
}
+ private MigrationContinuationListener.ContinuationResult migrationRequiresInput(MigrationContinuationListener.ContinuationEvent event) {
+ //TODO: creating a new scene seems a little over the top, maybe stick to this scene
+ // my suggestion is to make this quick and dirty by setting some elements unmanaged and invisible and afterwards activate them again
+ // otherwise: We need a more abstract runController which has two subviews (run and halted), see mainWindow for example
+ return MigrationContinuationListener.ContinuationResult.PROCEED;
+ }
+
private void loadStoredPassword() {
assert keychainAccess.isPresent();
char[] storedPw = null;
diff --git a/main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockController.java b/main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockController.java
index 936c451dc..6f754b4c1 100644
--- a/main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockController.java
+++ b/main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockController.java
@@ -73,7 +73,7 @@ public class UnlockController implements FxController {
if (keychainAccess.isPresent()) {
loadStoredPassword();
} else {
- savePassword.setDisable(true);
+ savePassword.setSelected(false);
}
unlockButtonDisabled.bind(vault.stateProperty().isNotEqualTo(VaultState.LOCKED).or(passwordField.textProperty().isEmpty()));
}
@@ -187,4 +187,8 @@ public class UnlockController implements FxController {
public boolean isUnlockButtonDisabled() {
return unlockButtonDisabled.get();
}
+
+ public boolean isKeychainAccessAvailable() {
+ return keychainAccess.isPresent();
+ }
}
diff --git a/main/ui/src/main/resources/css/dark_theme.css b/main/ui/src/main/resources/css/dark_theme.css
index 4a4e0c302..f9b113c77 100644
--- a/main/ui/src/main/resources/css/dark_theme.css
+++ b/main/ui/src/main/resources/css/dark_theme.css
@@ -854,7 +854,7 @@
.progress-bar > .bar {
-fx-background-color: CONTROL_PRIMARY_BG_NORMAL;
-fx-background-radius: 4px;
- -fx-padding: 0.5em;
+ -fx-padding: 1em 0.5em;
}
.progress-bar:indeterminate > .bar {
diff --git a/main/ui/src/main/resources/css/light_theme.css b/main/ui/src/main/resources/css/light_theme.css
index f020582ce..0170b32d7 100644
--- a/main/ui/src/main/resources/css/light_theme.css
+++ b/main/ui/src/main/resources/css/light_theme.css
@@ -853,7 +853,7 @@
.progress-bar > .bar {
-fx-background-color: CONTROL_PRIMARY_BG_NORMAL;
-fx-background-radius: 4px;
- -fx-padding: 0.5em;
+ -fx-padding: 1em 0.5em;
}
.progress-bar:indeterminate > .bar {
diff --git a/main/ui/src/main/resources/fxml/migration_impossible.fxml b/main/ui/src/main/resources/fxml/migration_impossible.fxml
new file mode 100644
index 000000000..46c1fb94f
--- /dev/null
+++ b/main/ui/src/main/resources/fxml/migration_impossible.fxml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/main/ui/src/main/resources/fxml/migration_run.fxml b/main/ui/src/main/resources/fxml/migration_run.fxml
index 27164c643..03be9a140 100644
--- a/main/ui/src/main/resources/fxml/migration_run.fxml
+++ b/main/ui/src/main/resources/fxml/migration_run.fxml
@@ -3,6 +3,7 @@
+
@@ -19,17 +20,20 @@
-
+
-
+
+
+
+
-
+