From 90a588cfc1c9620e532845eadd916e0dcfbb169b Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 27 Oct 2026 11:38:21 +0100 Subject: [PATCH] Separate unpublished avatars from malformed published storage --- tools/chatgui/tests/test_channel_settings.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/chatgui/tests/test_channel_settings.cpp b/tools/chatgui/tests/test_channel_settings.cpp index 4e6082bf..47bee51a 100644 --- a/tools/chatgui/tests/test_channel_settings.cpp +++ b/tools/chatgui/tests/test_channel_settings.cpp @@ -331,13 +331,18 @@ private slots: void avatarBlobTypesAndLimits() { QFETCH(QByteArray, value); QFETCH(bool, valid); QFETCH(int, bytes); SettingsCore core; QVERIFY(core.start()); - const QByteArray sql = "UPDATE channels SET avatar_data=" + value; + const QByteArray sql = "UPDATE channels SET avatar_version=1,avatar_data=" + value; QCOMPARE(sqlite3_exec(core.inst->topo_sqlite_db, sql.constData(), nullptr, nullptr, nullptr), SQLITE_OK); bool ok = !valid; const QByteArray result = core.db.getChannelAvatar(core.channel, &ok); QCOMPARE(ok, valid); QCOMPARE(result.size(), bytes); QVERIFY(core.db.getChannelAvatar("missing", &ok).isEmpty()); QVERIFY(!ok); } + void unpublishedAvatarIsAnEmptyRead() { + SettingsCore core; QVERIFY(core.start()); + bool ok = false; QVERIFY(core.db.getChannelAvatar(core.channel, &ok).isEmpty()); QVERIFY(ok); + } + #ifdef UTUN_TEST_SETTINGS_ALLOC_FAILURES void avatarAllocationFailure_data() { QTest::addColumn("source");