diff --git a/mealie/repos/repository_cookbooks.py b/mealie/repos/repository_cookbooks.py index 5469c8de459..5d970c3249f 100644 --- a/mealie/repos/repository_cookbooks.py +++ b/mealie/repos/repository_cookbooks.py @@ -1,3 +1,4 @@ +import re from collections.abc import Iterable from fastapi import HTTPException, status @@ -35,8 +36,8 @@ def update(self, match_value: str | int | UUID4, data: SaveCookBook | dict) -> R data = SaveCookBook(**data) new_slug = slugify(data.name) - if not (data.slug and data.slug.startswith(new_slug)): - data.slug = slugify(data.name) + if not (data.slug and re.match(f"^({new_slug})(-\d+)?$", data.slug)): + data.slug = new_slug max_retries = 10 for i in range(max_retries):