Remove temp attachment if not used

This commit is contained in:
J-Jamet
2020-09-13 13:38:33 +02:00
parent 66e68092d5
commit 0f6c8601d2
2 changed files with 2 additions and 3 deletions

View File

@@ -310,6 +310,7 @@ class EntryEditActivity : LockingActivity(),
override fun onAttachmentAction(fileUri: Uri, entryAttachmentState: EntryAttachmentState) {
when (entryAttachmentState.downloadState) {
AttachmentState.START -> {
mTempAttachments.add(entryAttachmentState.attachment)
entryEditContentsView?.apply {
// When only one attachment is allowed
if (!mAllowMultipleAttachments) {
@@ -322,7 +323,6 @@ class EntryEditActivity : LockingActivity(),
scrollView?.smoothScrollTo(0, it.toInt())
}
}
mTempAttachments.add(entryAttachmentState.attachment)
}
AttachmentState.IN_PROGRESS -> {
entryEditContentsView?.putAttachment(entryAttachmentState)

View File

@@ -598,8 +598,7 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
binariesToRemove.forEach {
try {
binaryPool.remove(it)
// bug with big attachment, not needed to be delete here
// it.clear()
it.clear()
} catch (e: Exception) {
Log.w(TAG, "Unable to clean binaries", e)
}