From f14dfe3900baa0a87a51f42188646f409b9beeb9 Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Mon, 5 Dec 2022 17:39:41 +0100 Subject: [PATCH] fix getitem on fips dataset --- sec_certs/dataset/fips.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sec_certs/dataset/fips.py b/sec_certs/dataset/fips.py index bfe48ea9..4d3f0bfd 100644 --- a/sec_certs/dataset/fips.py +++ b/sec_certs/dataset/fips.py @@ -90,10 +90,10 @@ def algorithm_dataset_path(self) -> Path: return self.algorithms_dir / "algorithms.json" def __getitem__(self, item: str) -> FIPSCertificate: - if len(item) < 5: - return super().__getitem__(fips_dgst(item)) - else: + try: return super().__getitem__(item) + except KeyError: + return super().__getitem__(fips_dgst(item)) def _extract_data_from_html_modules(self) -> None: """