Browse Source

fix bug using wrong mount flags

Armin Schrenk 2 years ago
parent
commit
fb1f3c4757

+ 8 - 1
src/main/java/org/cryptomator/common/mount/Mounter.java

@@ -58,7 +58,14 @@ public class Mounter {
 							builder.setLoopbackPort(settings.port().get()); //TODO: move port from settings to vaultsettings (see https://github.com/cryptomator/cryptomator/tree/feature/mount-setting-per-vault)
 					case LOOPBACK_HOST_NAME -> env.getLoopbackAlias().ifPresent(builder::setLoopbackHostName);
 					case READ_ONLY -> builder.setReadOnly(vaultSettings.usesReadOnlyMode().get());
-					case MOUNT_FLAGS -> builder.setMountFlags(Objects.requireNonNullElse(vaultSettings.mountFlags().getValue(), service.getDefaultMountFlags()));
+					case MOUNT_FLAGS -> {
+						var mountFlags = vaultSettings.mountFlags().get();
+						if( mountFlags == null || mountFlags.isBlank()) {
+							builder.setMountFlags(service.getDefaultMountFlags());
+						} else {
+							builder.setMountFlags(mountFlags);
+						}
+					}
 					case VOLUME_ID -> builder.setVolumeId(vaultSettings.getId());
 					case VOLUME_NAME -> builder.setVolumeName(vaultSettings.mountName().get());
 				}

+ 1 - 1
src/main/java/org/cryptomator/common/settings/VaultSettings.java

@@ -45,7 +45,7 @@ public class VaultSettings {
 	private final BooleanProperty unlockAfterStartup = new SimpleBooleanProperty(DEFAULT_UNLOCK_AFTER_STARTUP);
 	private final BooleanProperty revealAfterMount = new SimpleBooleanProperty(DEFAULT_REVEAL_AFTER_MOUNT);
 	private final BooleanProperty usesReadOnlyMode = new SimpleBooleanProperty(DEFAULT_USES_READONLY_MODE);
-	private final StringProperty mountFlags = new SimpleStringProperty(DEFAULT_MOUNT_FLAGS);
+	private final StringProperty mountFlags = new SimpleStringProperty(DEFAULT_MOUNT_FLAGS); //TODO: remove empty default mount flags and let this property be null if not used
 	private final IntegerProperty maxCleartextFilenameLength = new SimpleIntegerProperty(DEFAULT_MAX_CLEARTEXT_FILENAME_LENGTH);
 	private final ObjectProperty<WhenUnlocked> actionAfterUnlock = new SimpleObjectProperty<>(DEFAULT_ACTION_AFTER_UNLOCK);
 	private final BooleanProperty autoLockWhenIdle = new SimpleBooleanProperty(DEFAULT_AUTOLOCK_WHEN_IDLE);