From 345e709b6c02b7e8e795f1ed28afe546ff6e978e Mon Sep 17 00:00:00 2001 From: Sven Eberth Date: Tue, 20 Aug 2024 12:09:50 +0200 Subject: [PATCH] fix: `size` might be missing in file relation (#13) --- src/viur/toolkit/importer/importer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/viur/toolkit/importer/importer.py b/src/viur/toolkit/importer/importer.py index ebb905f..84e0a17 100644 --- a/src/viur/toolkit/importer/importer.py +++ b/src/viur/toolkit/importer/importer.py @@ -204,7 +204,11 @@ def import_file(self, info: dict[str, t.Any]) -> None | db.Key: name = info["name"] dlkey = info["dlkey"] servingurl = info.get("servingurl") - size = info["size"] + try: + size = info["size"] + except KeyError: + logger.warning(f"size is missing in {info=}") + size = -1 if not isinstance(size, int): try: