Skip to content

Commit 7790221

Browse files
committed
Fixes #176
1 parent 9ed893e commit 7790221

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +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;
2122
import org.cryptomator.cryptofs.dir.DirectoryStreamFactory;
2223
import org.cryptomator.cryptofs.fh.OpenCryptoFiles;
2324
import org.cryptomator.cryptolib.api.Cryptor;
@@ -623,7 +624,7 @@ private void moveDirectory(CryptoPath cleartextSource, CryptoPath cleartextTarge
623624
// check if dir is empty:
624625
Path targetCiphertextDirContentDir = cryptoPathMapper.getCiphertextDir(cleartextTarget).path;
625626
boolean targetCiphertextDirExists = true;
626-
try (DirectoryStream<Path> ds = Files.newDirectoryStream(targetCiphertextDirContentDir)) {
627+
try (DirectoryStream<Path> ds = Files.newDirectoryStream(targetCiphertextDirContentDir, new DirIdBackupFilter())) {
627628
if (ds.iterator().hasNext()) {
628629
throw new DirectoryNotEmptyException(cleartextTarget.toString());
629630
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.cryptomator.cryptofs.dir;
2+
3+
import org.cryptomator.cryptofs.common.Constants;
4+
5+
import java.io.IOException;
6+
import java.nio.file.DirectoryStream;
7+
import java.nio.file.Path;
8+
9+
public class DirIdBackupFilter implements DirectoryStream.Filter<Path> {
10+
11+
private final Path skippedEntry = Path.of(Constants.DIR_BACKUP_FILE_NAME);
12+
13+
@Override
14+
public boolean accept(Path entry) throws IOException {
15+
return entry.getFileName().equals(skippedEntry);
16+
}
17+
18+
}

0 commit comments

Comments
 (0)