From 81f5961d80a0e27339f03da4f975345bf2f14951 Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Fri, 3 Feb 2023 01:42:58 +0100 Subject: [PATCH] Prevent duplicates in updateinfo collection --- apollo/server/routes/api_updateinfo.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apollo/server/routes/api_updateinfo.py b/apollo/server/routes/api_updateinfo.py index dd54c48..3ea5f1d 100644 --- a/apollo/server/routes/api_updateinfo.py +++ b/apollo/server/routes/api_updateinfo.py @@ -207,7 +207,8 @@ async def get_updateinfo( "module_version": pkg.module_version, } no_default_collection = True - collections[collection_short]["packages"].append(pkg) + if pkg not in collections[collection_short]["packages"]: + collections[collection_short]["packages"].append(pkg) else: if no_default_collection: continue @@ -215,7 +216,10 @@ async def get_updateinfo( collections[default_collection_short] = { "packages": [], } - collections[default_collection_short]["packages"].append(pkg) + if pkg not in collections[default_collection_short]["packages"]: + collections[default_collection_short]["packages"].append( + pkg + ) if no_default_collection and default_collection_short in collections: del collections[default_collection_short]