nextcloud / nextcloud/cookbook
Update ingredient amount on importing recipe again to new serving number
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 641
- Forks
- 113
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 26
Description
Summary:
When importing the same recipe again a webserver error is show to the user.
Steps to Reproduce:
Import a recipe, for example Hummus with dried tomatos. (from german Chefkoch.de).
- Copy paste the recipe URL to URL field, and klick download button.
- Recipe get's imported.
Go to the recipe's original website and change the amount of servings, as supported by Chefkoch. For example changing from 8 servings to 4.
This changes the recipe URL to https://www.chefkoch.de/rezepte/2409581380640280/Hummus-mit-getrockneten-Tomaten.html?portionen=4. Notice the added GET paramter ?portionen=4.
Copy that new URL, and import that recipe again.
Expected Results:
I'd expect the already imported recipe to get updated with the new amounts.
Reasoning: Cookbook already seems to parse the “servings” amount and also displays it. (Though probably not parsed from the URL but from the page itself.)
Cookbook could determine that this is an existing recipe, because it tracks the source URL which is the same when disregarding the URL parameter.
Actual Results:
The user is presented with a webserver error message in a pop over. (nginx in my case).
Could not add recipe: <!DOCTYPE html>
<html>
<head>
<title>Error</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>An error occurred.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
<p>If you are the system administrator of this resource then you should check
the error log for details.</p>
<p><em>Faithfully yours, nginx.</em></p>
</body>
</html>
The recipe does not get updated with new amounts (as per the ?portionen=4 parameter ). User isn't asked to import the same recipe as a duplicate.
I am that system administrator. :-)
Regression:
n/a
Notes:
When in doubt, use more garlic to spice things up!
Version Information:
Nextcloud Hub 18.0.3
Cookbook 0.6.3
Webserver: nginx 1.17.9
PHP: PHP 7.3.16
Browser: Firefox 75.0 on macOS Mojave.
Nextcloud Log output
{"reqId":"hNQFePaZszXgLkWLWTUU","level":3,"time":"2020-04-12T20:23:06+00:00","remoteAddr":"<USER_IP_ADDRESS>","user":"<USERNAME>","app":"index","method":"GET","url":"/apps/cookbook/recipes/98710/image?size=thumb&t=1586722986","message":{"Exception":"Exception","Message":"Call to undefined method OC\\Files\\Node\\File::get()","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Cookbook\\Controller\\RecipeController"},"image"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Cookbook\\Controller\\RecipeController","image",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"id":"98710","_route":"cookbook.recipe.image"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"id":"98710","_route":"cookbook.recipe.image"}]},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"id":"98710","_route":"cookbook.recipe.image"}]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/cookbook/recipes/98710/image"]},{"file":"/usr/local/www/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":109,"Previous":{"Exception":"Error","Message":"Call to undefined method OC\\Files\\Node\\File::get()","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/apps/cookbook/lib/Controller/RecipeController.php","line":134,"function":"getRecipeImageFileByFolderId","class":"OCA\\Cookbook\\Service\\RecipeService","type":"->","args":["98710","thumb"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"image","class":"OCA\\Cookbook\\Controller\\RecipeController","type":"->","args":["98710"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Cookbook\\Controller\\RecipeController"},"image"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Cookbook\\Controller\\RecipeController"},"image"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Cookbook\\Controller\\RecipeController","image",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"id":"98710","_route":"cookbook.recipe.image"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"id":"98710","_route":"cookbook.recipe.image"}]},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"id":"98710","_route":"cookbook.recipe.image"}]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/cookbook/recipes/98710/image"]},{"file":"/usr/local/www/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/local/www/nextcloud/apps/cookbook/lib/Service/RecipeService.php","Line":944},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:75.0) Gecko/20100101 Firefox/75.0","version":"18.0.3.0"}
{"reqId":"3zQ8BgaYBPj89VgMkgMH","level":3,"time":"2020-04-12T20:23:06+00:00","remoteAddr":"<USER_IP_ADDRESS>","user":"<USERNAME>","app":"index","method":"GET","url":"/apps/cookbook/recipes/98455/image?size=thumb&t=1586722986","message":{"Exception":"Exception","Message":"Call to undefined method OC\\Files\\Node\\File::get()","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Cookbook\\Controller\\RecipeController"},"image"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Cookbook\\Controller\\RecipeController","image",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"id":"98455","_route":"cookbook.recipe.image"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"id":"98455","_route":"cookbook.recipe.image"}]},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"id":"98455","_route":"cookbook.recipe.image"}]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/cookbook/recipes/98455/image"]},{"file":"/usr/local/www/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":109,"Previous":{"Exception":"Error","Message":"Call to undefined method OC\\Files\\Node\\File::get()","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/apps/cookbook/lib/Controller/RecipeController.php","line":134,"function":"getRecipeImageFileByFolderId","class":"OCA\\Cookbook\\Service\\RecipeService","type":"->","args":["98455","thumb"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"image","class":"OCA\\Cookbook\\Controller\\RecipeController","type":"->","args":["98455"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Cookbook\\Controller\\RecipeController"},"image"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Cookbook\\Controller\\RecipeController"},"image"]},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Cookbook\\Controller\\RecipeController","image",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"id":"98455","_route":"cookbook.recipe.image"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"id":"98455","_route":"cookbook.recipe.image"}]},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"id":"98455","_route":"cookbook.recipe.image"}]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/cookbook/recipes/98455/image"]},{"file":"/usr/local/www/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/local/www/nextcloud/apps/cookbook/lib/Service/RecipeService.php","Line":944},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:75.0) Gecko/20100101 Firefox/75.0","version":"18.0.3.0"}
{"reqId":"d05ipJakzbPVjr88B11W","level":3,"time":"2020-04-12T20:23:16+00:00","remoteAddr":"<USER_IP_ADDRESS>","user":"<USERNAME>","app":"PHP","method":"GET","url":"/apps/cookbook/category/Beilage","message":"Undefined variable: tag at /usr/local/www/nextcloud/apps/cookbook/lib/Controller/MainController.php#141","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:75.0) Gecko/20100101 Firefox/75.0","version":"18.0.3.0"}
{"reqId":"RSdwRMKRvwbL3KMaTRcl","level":3,"time":"2020-04-12T20:23:18+00:00","remoteAddr":"<USER_IP_ADDRESS>","user":"<USERNAME>","app":"PHP","method":"GET","url":"/apps/cookbook/category/Haltbarmachen","message":"Undefined variable: tag at /usr/local/www/nextcloud/apps/cookbook/lib/Controller/MainController.php#141","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:75.0) Gecko/20100101 Firefox/75.0","version":"18.0.3.0"}
{"reqId":"TuO6r9ZA0dpkGSZTzWPm","level":3,"time":"2020-04-12T20:23:19+00:00","remoteAddr":"<USER_IP_ADDRESS>","user":"<USERNAME>","app":"PHP","method":"GET","url":"/apps/cookbook/category/K%C3%A4se","message":"Undefined variable: tag at /usr/local/www/nextcloud/apps/cookbook/lib/Controller/MainController.php#141","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:75.0) Gecko/20100101 Firefox/75.0","version":"18.0.3.0"}
{"reqId":"Qw8XE3tfO7goMTyHic6C","level":3,"time":"2020-04-12T20:23:21+00:00","remoteAddr":"<USER_IP_ADDRESS>","user":"<USERNAME>","app":"PHP","method":"GET","url":"/apps/cookbook/category/Schnell%20und%20einfach","message":"Undefined variable: tag at /usr/local/www/nextcloud/apps/cookbook/lib/Controller/MainController.php#141","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:75.0) Gecko/20100101 Firefox/75.0","version":"18.0.3.0"}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.