Fix issue with re-using forwarded attachment pointers.

We were deleting upload data for incoming attachments when we shouldn't
have.

Fixes #9570
This commit is contained in:
Greyson Parrelli
2020-04-30 14:04:53 -04:00
parent c9f2f57427
commit 9d35fb397b
2 changed files with 7 additions and 8 deletions

View File

@@ -535,14 +535,10 @@ public class AttachmentDatabase extends Database {
}
values.put(TRANSFER_STATE, TRANSFER_PROGRESS_DONE);
values.put(CDN_NUMBER, 0);
values.put(CONTENT_LOCATION, (String)null);
values.put(CONTENT_DISPOSITION, (String)null);
values.put(DIGEST, (byte[])null);
values.put(NAME, (String) null);
values.put(FAST_PREFLIGHT_ID, (String)null);
values.put(TRANSFER_FILE, (String)null);
values.put(TRANSFORM_PROPERTIES, TransformProperties.forSkipTransform().serialize());
if (database.update(TABLE_NAME, values, PART_ID_WHERE, attachmentId.toStrings()) == 0) {
//noinspection ResultOfMethodCallIgnored
dataInfo.file.delete();
@@ -1198,7 +1194,9 @@ public class AttachmentDatabase extends Database {
}
}
boolean useTemplateUpload = template.getUploadTimestamp() > attachment.getUploadTimestamp() && template.getTransferState() == TRANSFER_PROGRESS_DONE;
boolean useTemplateUpload = template.getUploadTimestamp() > attachment.getUploadTimestamp() &&
template.getTransferState() == TRANSFER_PROGRESS_DONE &&
template.getTransformProperties().shouldSkipTransform();
ContentValues contentValues = new ContentValues();
contentValues.put(MMS_ID, mmsId);