mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-08-21 06:36:01 +00:00
exclude dirid.c9r
This commit is contained in:
@@ -19,6 +19,7 @@ import java.nio.file.StandardOpenOption;
|
|||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -63,10 +64,8 @@ public final class MasterkeyService {
|
|||||||
|
|
||||||
public static Optional<CryptorProvider.Scheme> detect(Masterkey masterkey, Path vaultPath) {
|
public static Optional<CryptorProvider.Scheme> detect(Masterkey masterkey, Path vaultPath) {
|
||||||
try (Stream<Path> paths = Files.walk(vaultPath.resolve(DATA_DIR_NAME))) {
|
try (Stream<Path> paths = Files.walk(vaultPath.resolve(DATA_DIR_NAME))) {
|
||||||
Optional<Path> c9rFile = paths //
|
List<String> excludedFilenames = List.of("dirid.c9r", "dir.c9r");
|
||||||
.filter(p -> p.toString().endsWith(".c9r")) //
|
Optional<Path> c9rFile = paths.filter(p -> p.toString().endsWith(".c9r")).filter(p -> excludedFilenames.stream().noneMatch(p.toString()::endsWith)).findFirst();
|
||||||
.filter(p -> !p.toString().equals("dir.c9r")) //
|
|
||||||
.findFirst();
|
|
||||||
if (c9rFile.isEmpty()) {
|
if (c9rFile.isEmpty()) {
|
||||||
LOG.info("Unable to detect Crypto scheme: No *.c9r file found in {}", vaultPath);
|
LOG.info("Unable to detect Crypto scheme: No *.c9r file found in {}", vaultPath);
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
|||||||
Reference in New Issue
Block a user