Verify cache restoration and channel cleanup for encrypted attachments

This commit is contained in:
evgeny committed 2026-10-18 10:40:24 +02:00
1 parent 5d2522b8de
commit 8a46a53a21
2 files changed
+14 -1

No files matched your search

+13 -1
View File
@@ -261,11 +261,23 @@ static void tick(void* arg) {
inject(t, A, B, ROUTER_FLAG_ENCRYPTED | ROUTER_FLAG_SIGNED, 0); inject(t, A, B, ROUTER_FLAG_ENCRYPTED | ROUTER_FLAG_SIGNED, 0);
if (!readable(t, B) || value(b, "SELECT count(*) FROM attachment_key_requests") != 1 || if (!readable(t, B) || value(b, "SELECT count(*) FROM attachment_key_requests") != 1 ||
value(a, "SELECT count(*) FROM attachment_key_requests") != 2) { failure(t, "duplicate grant changed persisted access"); return; } value(a, "SELECT count(*) FROM attachment_key_requests") != 2) { failure(t, "duplicate grant changed persisted access"); return; }
sqlite3_stmt* cached = NULL;
if (sqlite3_prepare_v2(b->topo_sqlite_db, "SELECT plain_path FROM attachment_keys", -1, &cached, NULL) ||
sqlite3_step(cached) != SQLITE_ROW || remove((const char*)sqlite3_column_text(cached, 0))) {
sqlite3_finalize(cached); failure(t, "cache eviction fixture"); return;
}
sqlite3_finalize(cached); download(t, B);
t->phase++; t->phase++;
} }
break; break;
case 9: case 9:
if (++t->hold >= 20) { t->phase++; uasync_stop(t->ua); return; } if (readable(t, B) && ++t->hold >= 20) {
if (value(a, "SELECT count(*) FROM attachment_key_requests") != 2) { failure(t, "cache restore requested another consent"); return; }
chat_core_delete_channel(c, CHANNEL);
if (value(c, "SELECT count(*) FROM attachment_keys") || value(c, "SELECT count(*) FROM attachment_key_requests") ||
value(c, "SELECT count(*) FROM attachment_key_outbox")) { failure(t, "deleted channel retained grants/requests"); return; }
t->phase++; uasync_stop(t->ua); return;
}
break; break;
} }
if (t->failed) return; if (t->failed) return;
+1
View File
@@ -471,6 +471,7 @@ void InputBar::setRecordingContext(const QString& mediaDirBase, const QString& c
if (m_channelIdForRecord != channelId || m_mediaDirBase != mediaDirBase) { if (m_channelIdForRecord != channelId || m_mediaDirBase != mediaDirBase) {
clearReply(); clearReply();
++m_attachmentContext; ++m_attachmentContext;
m_encryptBtn->setChecked(false);
clearPendingAttachment(); clearPendingAttachment();
if (m_dropHint) m_dropHint->hide(); if (m_dropHint) m_dropHint->hide();
} }