openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
653 stars 383 forks source link

Illegal division by zero at Images.pm line 996 (related to an error while saving a crop on Jan 30th at 11:32) #4805

Open teolemon opened 3 years ago

teolemon commented 3 years ago

Cause

Error while saving a crop on Jan 30th at 11:32. The image had been uploaded to a wrong product using the barcode recognition in the sidebar, then I dragged and dropped it into the product in edit mode, and the sidebar tried to recognize it and redirected me to the other product. Then finally I clicked on the upload image, it went fine, but the cropping threw me the following error:

image

Symptom

image

Query

Request URL: https://world.openfoodfacts.org/cgi/product_image_crop.pl
Request Method: POST
Status Code: 500 
Referrer Policy: strict-origin-when-cross-origin
content-length: 305
content-type: text/html; charset=iso-8859-1
date: Sat, 30 Jan 2021 10:35:27 GMT
server: nginx/1.10.3
:authority: world.openfoodfacts.org
:method: POST
:path: /cgi/product_image_crop.pl
:scheme: https
accept: application/json, text/javascript, */*; q=0.01
accept-encoding: gzip, deflate, br
accept-language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
content-length: 201
content-type: application/x-www-form-urlencoded; charset=UTF-8
cookie: _ga=GA; hide_image_banner=1; session=user_session&XXXXXXXS&user_id&teolemon
dnt: 1
origin: https://world.openfoodfacts.org
referer: https://world.openfoodfacts.org/cgi/product.pl?type=edit&code=3270160203796
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-origin
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36
x-requested-with: XMLHttpRequest
code: 3270160203796
id: ingredients_ja
imgid: 35
x1: 320.9170892494929
y1: 153.44333164300204
x2: 1599.8549695740364
y2: 897.5750507099391
coordinates_image_size: full
angle: 0
normalize: false
white_magic: false

Response

<h1>Software error:</h1>
<pre>Illegal division by zero at /srv/off/lib/ProductOpener/Images.pm line 996.
</pre>
<p>
For help, please send mail to the webmaster (<a href="mailto:contact@openfoodfacts.org">contact@openfoodfacts.org</a>), giving this error message 
and the time and date of the error.

</p>

https://github.com/openfoodfacts/openfoodfacts-server/blob/9d62715f422edf08f1ae69731c385081239b5546/lib/ProductOpener/Images.pm#L996

github-actions[bot] commented 8 months ago

This issue has been open 90 days with no activity. Can you give it a little love by linking it to a parent issue, adding relevant labels and projets, creating a mockup if applicable, adding code pointers from https://github.com/openfoodfacts/openfoodfacts-server/blob/main/.github/labeler.yml, giving it a priority, editing the original issue to have a more comprehensive description… Thank you very much for your contribution to 🍊 Open Food Facts