From f8865dc46b259324e532e729940a1f7793759ff5 Mon Sep 17 00:00:00 2001 From: Richard Olsson Date: Wed, 27 Sep 2023 15:15:29 +0200 Subject: [PATCH] Handle empty YAML files when syncing --- backend/translations/utils/sync_project.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/translations/utils/sync_project.py b/backend/translations/utils/sync_project.py index 7ceb31f..add19fa 100644 --- a/backend/translations/utils/sync_project.py +++ b/backend/translations/utils/sync_project.py @@ -59,6 +59,9 @@ def sync_project(project: Project): if language_code in [lang.language_code for lang in project.languages.all()]: try: file_object = yaml.load(file.decoded_content, Loader=BaseLoader) + if file_object is None: + continue + flat_file_object = json_normalize( file_object, sep=".", errors="ignore" ).to_dict(orient="records")[0]