diff --git a/mealie/services/migrations/_migration_base.py b/mealie/services/migrations/_migration_base.py index 1268a38fb7c..383e71e26f3 100644 --- a/mealie/services/migrations/_migration_base.py +++ b/mealie/services/migrations/_migration_base.py @@ -209,7 +209,11 @@ def rewrite_alias(self, recipe_dict: dict) -> dict: continue if alias.func: - prop_value = alias.func(prop_value) + try: + prop_value = alias.func(prop_value) + except Exception as e: + self.logger.exception(e) + continue recipe_dict[alias.key] = prop_value diff --git a/mealie/services/migrations/paprika.py b/mealie/services/migrations/paprika.py index d0b64ac3859..3f92339afa1 100644 --- a/mealie/services/migrations/paprika.py +++ b/mealie/services/migrations/paprika.py @@ -38,7 +38,7 @@ def __init__(self, **kwargs): re_num_list = re.compile(r"^\d+\.\s") self.key_aliases = [ - MigrationAlias(key="recipeIngredient", alias="ingredients", func=lambda x: x.split("\n")), + MigrationAlias(key="recipeIngredient", alias="ingredients", func=lambda x: x.split("\n") if x else ""), MigrationAlias(key="orgURL", alias="source_url", func=None), MigrationAlias(key="totalTime", alias="total_time", func=None), MigrationAlias(key="prepTime", alias="prep_time", func=None), @@ -62,7 +62,7 @@ def __init__(self, **kwargs): MigrationAlias( key="recipeInstructions", alias="directions", - func=lambda x: [{"text": re.sub(re_num_list, "", s)} for s in x.split("\n\n")], + func=lambda x: [{"text": re.sub(re_num_list, "", s)} for s in x.split("\n\n")] if x else [], ), ]