From bcf8dd1b9c70749f262556402db03810e82bc41b Mon Sep 17 00:00:00 2001 From: Benjamin Ooghe-Tabanou Date: Mon, 21 Aug 2023 12:31:58 +0200 Subject: [PATCH] fix links cache corrupted by json converting int keys to string --- hyphe_backend/core.tac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyphe_backend/core.tac b/hyphe_backend/core.tac index a466da5a..662127e3 100755 --- a/hyphe_backend/core.tac +++ b/hyphe_backend/core.tac @@ -399,7 +399,7 @@ class Core(customJSONRPC): cache_path = os.path.join(config["traph"]["data_path"], "%s_webentitieslinks.json" % corpus) try: with open(cache_path) as f: - return json.load(f) + return json.load(f, object_hook=lambda x: {(int(k) if k.isdigit() else k): v for k, v in x.items()}) except Exception as e: logger.msg("Could not read cached links from filesystem: %s %s (%s)" % (cache_path, e, type(e)), system="WARNING - %s" % corpus) return {}