diff options
author | saturneric <[email protected]> | 2025-04-19 02:26:58 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-04-19 02:26:58 +0000 |
commit | 6c55cc05c30de62d93162aad5e8b25f735b1055e (patch) | |
tree | 1a7afb1be3d9bbac4bc47d1d8d7dd32d36ff8eb0 /src | |
parent | fix: find out adsk problem of flatpak (diff) | |
download | GpgFrontend-6c55cc05c30de62d93162aad5e8b25f735b1055e.tar.gz GpgFrontend-6c55cc05c30de62d93162aad5e8b25f735b1055e.zip |
fix: remove unnecessary assert
Diffstat (limited to 'src')
-rw-r--r-- | src/core/function/gpg/GpgKeyGetter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp index 9fb0f6db..9240151d 100644 --- a/src/core/function/gpg/GpgKeyGetter.cpp +++ b/src/core/function/gpg/GpgKeyGetter.cpp @@ -46,8 +46,6 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> { // find in cache first if (cache) { auto key = get_key_in_cache(key_id); - assert(key->KeyType() == GpgAbstractKeyType::kGPG_KEY); - if (key != nullptr) return qSharedPointerDynamicCast<GpgKey>(key); LOG_W() << "get gpg key" << key_id @@ -165,11 +163,14 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> { for (const auto& s_key : g_key->SubKeys()) { if (s_key.ID() == g_key->ID()) continue; - auto p_s_key = QSharedPointer<GpgSubKey>::create(s_key); // don't add adsk key or it will cause bugs - if (p_s_key->IsADSK()) continue; + if (s_key.IsADSK()) continue; + // subkeys should be weaker than primary key + if (keys_search_cache_.contains(s_key.ID())) continue; + + auto p_s_key = QSharedPointer<GpgSubKey>::create(s_key); keys_search_cache_.insert(s_key.ID(), p_s_key); keys_search_cache_.insert(s_key.Fingerprint(), p_s_key); } |