nextcloud / cookbook

🍲 A library for all your recipes
https://apps.nextcloud.com/apps/cookbook
GNU Affero General Public License v3.0
522 stars 89 forks source link

Fail to download images #2033

Open hockeymikey opened 8 months ago

hockeymikey commented 8 months ago

Description Images are unable to be downloaded. The images are correct and I have tried a few of them. They used to work and just stopped working randomly.

Reproduction Steps to reproduce the behavior:

  1. Create a recipe with a valid image link
  2. Save

Expected behavior Image downloads fine

Actual behavior It times out with an error message

Logs {"reqId":"Hk8vgNCkiP4RB2kqpLrM","level":3,"time":"2023-12-27T23:01:33-06:00","remoteAddr":"96.2.125.193","user":"hockeymikey","app":"PHP","method":"PUT","url":"/apps/cookbook/webapp/recipes/6053237","message":"file_get_contents(https://www.ketokeuhnnutrition.com/wp-content/uploads/2021/06/sliced-bread-loaf.jpg): Failed to open stream: Connection timed out at /var/lib/nextcloud/apps/cookbook/lib/Service/RecipeService.php#273","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0","version":"27.1.4.1","data":{"app":"PHP"}}

Browser LibreWolf

Versions Nextcloud server version: 27.1.4 Cookbook version: 0.10.5 Database system: MariaDB: 11.2.2

christianlupus commented 8 months ago

The issue happens only at random times, at other times it works as expected? Is there some time correlation (ifit happens at some time, it takes some time until it works again)?

The problem might be some protection of the site you load the image from or simply overload protection (rate limiting).

I see two points to handle here:

  1. Handle such errors better and store the recipe nontheless.
  2. Use the client browser to download the recipe and images and upload the package to the server.

Does this fit your expectations?