mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-10-01 12:15:32 +00:00
- don't write encrypted file header, if no actual write happens inside of an encrypted writable file (temporary workaround only!)
- reduced loglevel
This commit is contained in:
+4
-1
@@ -32,6 +32,7 @@ class CryptoWritableFile implements WritableFile {
|
||||
|
||||
private FileContentEncryptor encryptor;
|
||||
private Future<Void> writeTask;
|
||||
private boolean contentChanged = false;
|
||||
|
||||
public CryptoWritableFile(FileContentCryptor cryptor, WritableFile file) {
|
||||
this.file = file;
|
||||
@@ -54,6 +55,7 @@ class CryptoWritableFile implements WritableFile {
|
||||
|
||||
@Override
|
||||
public int write(ByteBuffer source) {
|
||||
contentChanged = true;
|
||||
final int size = source.remaining();
|
||||
final ByteBuffer cleartextCopy = ByteBuffer.allocate(size);
|
||||
ByteBuffers.copy(source, cleartextCopy);
|
||||
@@ -99,6 +101,7 @@ class CryptoWritableFile implements WritableFile {
|
||||
|
||||
@Override
|
||||
public void truncate() {
|
||||
contentChanged = true;
|
||||
terminateAndWaitForWriteTask();
|
||||
file.truncate();
|
||||
initialize(0);
|
||||
@@ -112,7 +115,7 @@ class CryptoWritableFile implements WritableFile {
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
if (file.isOpen()) {
|
||||
if (contentChanged && file.isOpen()) {
|
||||
terminateAndWaitForWriteTask();
|
||||
writeHeader();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user