Closed dino9848 closed 1 week ago
Able to delete from the data management admin account. Regular user can't delete.
Solution here is to stop a recipe being able to be created when the title (removing whitespace) is null
The route seems to call RecipeService.create_one()
which has the following code:
def create_one(self, create_data: Recipe | CreateRecipe) -> Recipe:
if create_data.name is None:
create_data.name = "New Recipe"
It seems like the correct thing might be just to change that to:
def create_one(self, create_data: Recipe | CreateRecipe) -> Recipe:
if not create_data.name:
create_data.name = "New Recipe"
Later code handles deduping if there are previous "New Recipe". Though the proposed changes don't handle leading/trailing spaces so it will have to be a little more complicated than that.
We should have a "clean string" method somewhere that handles things like that, probably with the migration code. Although honestly we should probably handle that when creating the slug since slugs already clean strings anyway
First Check
What is the issue you are experiencing?
Create a manual recipe on the demo site by creating a recipe titled with just a single space creates a 404 error and no way to delete or edit the issue
Steps to Reproduce
1) Click Create - select the 'create a recipe manually' 2) enter a single space in the recipe name box and click "Create"
It creates a recipe without any option to delete from the GUI. Clicking on the edit option creates the 404 error
Note: If you do this twice, the second recipe created with automatically be named "(1)" and it does allow editing and deleting. Best regards and thanks for a wonderful app.
Please provide relevant logs
No need. It happens on every version I tried. Can even be reproduced on your demo site. Would love to be able to correct my database that has one of these 'no-name can't delete' recipes
Mealie Version
No response
Deployment
Docker (Linux)
Additional Deployment Details
Running on current CasaOS