@@ -53,13 +53,12 @@ public CryptoFileSystemImpl create(CryptoFileSystemProvider provider, Path pathT
5353 try (Masterkey key = properties .keyLoader ().loadKey (keyId )) {
5454 var config = configLoader .verify (key .getEncoded (), Constants .VAULT_VERSION );
5555 backupVaultConfigFile (normalizedPathToVault , properties );
56- var adjustedProperties = adjustForCapabilities (pathToVault , properties );
5756 var cryptor = CryptorProvider .forScheme (config .getCipherCombo ()).provide (key .copy (), csprng );
5857 try {
5958 checkVaultRootExistence (pathToVault , cryptor );
6059 return fileSystems .compute (normalizedPathToVault , (path , fs ) -> {
6160 if (fs == null ) {
62- return cryptoFileSystemComponentFactory .create (cryptor , config , provider , normalizedPathToVault , adjustedProperties ).cryptoFileSystem ();
61+ return cryptoFileSystemComponentFactory .create (cryptor , config , provider , normalizedPathToVault , properties ).cryptoFileSystem ();
6362 } else {
6463 throw new FileSystemAlreadyExistsException ();
6564 }
@@ -123,23 +122,6 @@ private void backupVaultConfigFile(Path pathToVault, CryptoFileSystemProperties
123122 BackupHelper .attemptBackup (vaultConfigFile );
124123 }
125124
126- private CryptoFileSystemProperties adjustForCapabilities (Path pathToVault , CryptoFileSystemProperties originalProperties ) throws FileSystemCapabilityChecker .MissingCapabilityException {
127- if (!originalProperties .readonly ()) {
128- try {
129- capabilityChecker .assertWriteAccess (pathToVault );
130- return originalProperties ;
131- } catch (FileSystemCapabilityChecker .MissingCapabilityException e ) {
132- capabilityChecker .assertReadAccess (pathToVault );
133- LOG .warn ("No write access to vault. Fallback to read-only access." );
134- Set <CryptoFileSystemProperties .FileSystemFlags > flags = EnumSet .copyOf (originalProperties .flags ());
135- flags .add (CryptoFileSystemProperties .FileSystemFlags .READONLY );
136- return CryptoFileSystemProperties .cryptoFileSystemPropertiesFrom (originalProperties ).withFlags (flags ).build ();
137- }
138- } else {
139- return originalProperties ;
140- }
141- }
142-
143125 public void remove (CryptoFileSystemImpl cryptoFileSystem ) {
144126 fileSystems .values ().remove (cryptoFileSystem );
145127 }
0 commit comments