From 88d095fb369dea5c993c78e85be08df5283d6436 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 31 Jan 2020 17:08:04 -0800 Subject: filter out shadows-only files in webface --- python/fatcat_web/entity_helpers.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'python/fatcat_web/entity_helpers.py') diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py index af0fea83..022d6f99 100644 --- a/python/fatcat_web/entity_helpers.py +++ b/python/fatcat_web/entity_helpers.py @@ -53,6 +53,10 @@ def enrich_release_entity(entity): entity._es = release_to_elasticsearch(entity, force_bool=False) if entity.container and entity.container.state == "active": entity.container._es = container_to_elasticsearch(entity.container, force_bool=False) + if entity.files: + # remove shadows-only files with no URLs + entity.files = [f for f in entity.files + if not (not f.urls and f.extra and f.extra.get('shadows'))] if entity.filesets: for fs in entity.filesets: fs._total_size = sum([f.size for f in fs.manifest]) -- cgit v1.2.3 From fd86c5ac74512a92bc5cbe25f8ec1f963d6cc1e6 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 3 Feb 2020 21:36:29 -0800 Subject: clarify shadow filter code --- python/fatcat_web/entity_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/fatcat_web/entity_helpers.py') diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py index 022d6f99..591dda80 100644 --- a/python/fatcat_web/entity_helpers.py +++ b/python/fatcat_web/entity_helpers.py @@ -56,7 +56,7 @@ def enrich_release_entity(entity): if entity.files: # remove shadows-only files with no URLs entity.files = [f for f in entity.files - if not (not f.urls and f.extra and f.extra.get('shadows'))] + if not (f.extra and f.extra.get('shadows') and not f.urls)] if entity.filesets: for fs in entity.filesets: fs._total_size = sum([f.size for f in fs.manifest]) -- cgit v1.2.3