Added attachment logging

pull/156/head
M66B 6 years ago
parent 87bb343518
commit 9f756079b1

@ -720,7 +720,7 @@ class Core {
if (local == null)
local = db.attachment().getAttachment(message.id, (int) id); // legacy
if (local == null)
throw new IllegalArgumentException("Attachment not found");
throw new IllegalArgumentException("Local attachment not found");
if (local.available)
return;
@ -752,8 +752,12 @@ class Core {
if (!found) {
db.attachment().setError(local.id, "Attachment not found");
if (!EntityFolder.DRAFTS.equals(folder.type))
throw new IllegalArgumentException("Attachment not found: " + local);
if (!EntityFolder.DRAFTS.equals(folder.type)) {
Log.w("Attachment not found local=" + local);
for (EntityAttachment remote : remotes)
Log.w("Attachment remote=" + remote);
throw new IllegalArgumentException("Attachment not found");
}
}
updateMessageSize(context, message.id);
@ -1628,6 +1632,7 @@ class Core {
if (!local.available)
if (state.getNetworkState().isUnmetered() || (local.size != null && local.size < maxSize))
try {
boolean found = false;
for (int i = 0; i < remotes.size(); i++) {
EntityAttachment remote = remotes.get(i);
if (Objects.equals(remote.name, local.name) &&
@ -1635,9 +1640,17 @@ class Core {
Objects.equals(remote.disposition, local.disposition) &&
Objects.equals(remote.cid, local.cid) &&
Objects.equals(remote.encryption, local.encryption) &&
Objects.equals(remote.size, local.size))
Objects.equals(remote.size, local.size)) {
found = true;
parts.downloadAttachment(context, i, local.id, local.name);
}
}
if (!found) {
Log.w("Attachment not found local=" + local);
for (EntityAttachment remote : remotes)
Log.w("Attachment remote=" + remote);
}
} catch (Throwable ex) {
Log.e(ex);
}

@ -160,6 +160,11 @@ public class EntityAttachment {
@NonNull
@Override
public String toString() {
return (this.name + " type=" + this.type + " disposition=" + this.disposition + " cid=" + this.cid + " size=" + this.size);
return (this.name +
" type=" + this.type +
" disposition=" + this.disposition +
" cid=" + this.cid +
" encryption=" + this.encryption +
" size=" + this.size);
}
}

Loading…
Cancel
Save