mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-29 16:10:19 +00:00
Removed use of Files.isRegularFile from UI module, references #592
This commit is contained in:
@@ -112,13 +112,8 @@ public abstract class UpgradeStrategy {
|
||||
public boolean isApplicable(Vault vault) {
|
||||
final Path masterkeyFile = vault.getPath().resolve(MASTERKEY_FILENAME);
|
||||
try {
|
||||
if (Files.isRegularFile(masterkeyFile)) {
|
||||
byte[] masterkeyFileContents = Files.readAllBytes(masterkeyFile);
|
||||
return KeyFile.parse(masterkeyFileContents).getVersion() == vaultVersionBeforeUpgrade;
|
||||
} else {
|
||||
LOG.warn("Not a file: {}", masterkeyFile);
|
||||
return false;
|
||||
}
|
||||
byte[] masterkeyFileContents = Files.readAllBytes(masterkeyFile);
|
||||
return KeyFile.parse(masterkeyFileContents).getVersion() == vaultVersionBeforeUpgrade;
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Could not determine, whether upgrade is applicable.", e);
|
||||
return false;
|
||||
|
||||
@@ -97,7 +97,7 @@ class UpgradeVersion3to4 extends UpgradeStrategy {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
String name = file.getFileName().toString();
|
||||
if (!attrs.isRegularFile() || attrs.size() > FILE_MIN_SIZE) {
|
||||
if (attrs.size() > FILE_MIN_SIZE) {
|
||||
LOG.trace("Skipping non-directory file {}.", file);
|
||||
} else if (name.endsWith(LONG_FILENAME_EXT)) {
|
||||
migrateLong(metadataDir, file);
|
||||
@@ -147,7 +147,7 @@ class UpgradeVersion3to4 extends UpgradeStrategy {
|
||||
String oldCanonicalName = oldNameBase32 + LONG_FILENAME_EXT;
|
||||
|
||||
Path oldMetadataFile = metadataDir.resolve(oldCanonicalName.substring(0, 2)).resolve(oldCanonicalName.substring(2, 4)).resolve(oldCanonicalName);
|
||||
if (!Files.isRegularFile(oldMetadataFile)) {
|
||||
if (!Files.isReadable(oldMetadataFile)) {
|
||||
LOG.warn("Found uninflatable long file name. Expected: {}", oldMetadataFile);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class UpgradeVersion4to5 extends UpgradeStrategy {
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
if (attrs.isRegularFile() && BASE32_PATTERN.matcher(file.getFileName().toString()).find() && attrs.size() > cryptor.fileHeaderCryptor().headerSize()) {
|
||||
if (BASE32_PATTERN.matcher(file.getFileName().toString()).find() && attrs.size() > cryptor.fileHeaderCryptor().headerSize()) {
|
||||
migrate(file, attrs, cryptor);
|
||||
} else {
|
||||
LOG.info("Skipping irrelevant file {}.", file);
|
||||
|
||||
Reference in New Issue
Block a user