diff --git a/app/src/main/java/sushi/hardcore/droidfs/file_operations/FileOperationService.kt b/app/src/main/java/sushi/hardcore/droidfs/file_operations/FileOperationService.kt index 32f325b..bae0b3d 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/file_operations/FileOperationService.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/file_operations/FileOperationService.kt @@ -141,6 +141,7 @@ class FileOperationService : Service() { break } } + encryptedVolume.truncate(dstPath, offset) encryptedVolume.closeFile(dstFileHandle) } else { success = false diff --git a/app/src/main/java/sushi/hardcore/droidfs/filesystems/EncryptedVolume.kt b/app/src/main/java/sushi/hardcore/droidfs/filesystems/EncryptedVolume.kt index c1a39f8..49a7af1 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/filesystems/EncryptedVolume.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/filesystems/EncryptedVolume.kt @@ -77,6 +77,7 @@ abstract class EncryptedVolume: Parcelable { abstract fun read(fileHandle: Long, buffer: ByteArray, offset: Long): Int abstract fun write(fileHandle: Long, offset: Long, buffer: ByteArray, size: Int): Int abstract fun closeFile(fileHandle: Long): Boolean + // Due to gocryptfs internals, truncate requires the file to be open before it is called abstract fun truncate(path: String, size: Long): Boolean abstract fun deleteFile(path: String): Boolean abstract fun readDir(path: String): MutableList? @@ -142,6 +143,7 @@ abstract class EncryptedVolume: Parcelable { break } } + truncate(dst_path, offset) closeFile(dstfileHandle) inputStream.close() return success