Skip to content

Commit 450c4b5

Browse files
committed
fixed wrong implementation
1 parent 139f641 commit 450c4b5

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/main/java/org/cryptomator/cryptofs/CryptoFileSystemImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.cryptomator.cryptofs.common.DeletingFileVisitor;
1919
import org.cryptomator.cryptofs.common.FinallyUtil;
2020
import org.cryptomator.cryptofs.dir.CiphertextDirectoryDeleter;
21-
import org.cryptomator.cryptofs.dir.DirIdBackupFilter;
21+
import org.cryptomator.cryptofs.dir.ExcludeDirIdBackupFilter;
2222
import org.cryptomator.cryptofs.dir.DirectoryStreamFactory;
2323
import org.cryptomator.cryptofs.fh.OpenCryptoFiles;
2424
import org.cryptomator.cryptolib.api.Cryptor;
@@ -624,7 +624,7 @@ private void moveDirectory(CryptoPath cleartextSource, CryptoPath cleartextTarge
624624
// check if dir is empty:
625625
Path targetCiphertextDirContentDir = cryptoPathMapper.getCiphertextDir(cleartextTarget).path;
626626
boolean targetCiphertextDirExists = true;
627-
try (DirectoryStream<Path> ds = Files.newDirectoryStream(targetCiphertextDirContentDir, new DirIdBackupFilter())) {
627+
try (DirectoryStream<Path> ds = Files.newDirectoryStream(targetCiphertextDirContentDir, new ExcludeDirIdBackupFilter())) {
628628
if (ds.iterator().hasNext()) {
629629
throw new DirectoryNotEmptyException(cleartextTarget.toString());
630630
}

src/main/java/org/cryptomator/cryptofs/dir/DirIdBackupFilter.java renamed to src/main/java/org/cryptomator/cryptofs/dir/ExcludeDirIdBackupFilter.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
import java.nio.file.DirectoryStream;
77
import java.nio.file.Path;
88

9-
public class DirIdBackupFilter implements DirectoryStream.Filter<Path> {
10-
11-
private final Path skippedEntry = Path.of(Constants.DIR_BACKUP_FILE_NAME);
9+
public class ExcludeDirIdBackupFilter implements DirectoryStream.Filter<Path> {
1210

1311
@Override
1412
public boolean accept(Path entry) throws IOException {
15-
return entry.getFileName().equals(skippedEntry);
13+
return !entry.equals(entry.resolveSibling(Constants.DIR_BACKUP_FILE_NAME));
1614
}
1715

1816
}

0 commit comments

Comments
 (0)