diff --git a/cookbook/helper/image_processing.py b/cookbook/helper/image_processing.py
index d9a334acb..552bf1312 100644
--- a/cookbook/helper/image_processing.py
+++ b/cookbook/helper/image_processing.py
@@ -38,10 +38,12 @@ def get_filetype(name):
# TODO this whole file needs proper documentation, refactoring, and testing
# TODO also add env variable to define which images sizes should be compressed
-def handle_image(request, image_object, filetype='.jpeg'):
+# filetype argument can not be optional, otherwise this function will treat all images as if they were a jpeg
+# Because it's no longer optional, no reason to return it
+def handle_image(request, image_object, filetype):
if (image_object.size / 1000) > 500: # if larger than 500 kb compress
if filetype == '.jpeg' or filetype == '.jpg':
- return rescale_image_jpeg(image_object), filetype
+ return rescale_image_jpeg(image_object)
if filetype == '.png':
- return rescale_image_png(image_object), filetype
- return image_object, filetype
+ return rescale_image_png(image_object)
+ return image_object
diff --git a/cookbook/helper/ingredient_parser.py b/cookbook/helper/ingredient_parser.py
index 8c07635af..593dea7e3 100644
--- a/cookbook/helper/ingredient_parser.py
+++ b/cookbook/helper/ingredient_parser.py
@@ -221,7 +221,7 @@ class IngredientParser:
# some people/languages put amount and unit at the end of the ingredient string
# if something like this is detected move it to the beginning so the parser can handle it
- if re.search(r'^([A-z])+(.)*[1-9](\d)*\s([A-z])+', ingredient):
+ if len(ingredient) < 1000 and re.search(r'^([A-z])+(.)*[1-9](\d)*\s([A-z])+', ingredient):
match = re.search(r'[1-9](\d)*\s([A-z])+', ingredient)
print(f'reording from {ingredient} to {ingredient[match.start():match.end()] + " " + ingredient.replace(ingredient[match.start():match.end()], "")}')
ingredient = ingredient[match.start():match.end()] + ' ' + ingredient.replace(ingredient[match.start():match.end()], '')
diff --git a/cookbook/integration/integration.py b/cookbook/integration/integration.py
index 6493c266d..c3dc9dfb7 100644
--- a/cookbook/integration/integration.py
+++ b/cookbook/integration/integration.py
@@ -253,7 +253,7 @@ class Integration:
:param image_file: ByteIO stream containing the image
:param filetype: type of file to write bytes to, default to .jpeg if unknown
"""
- recipe.image = File(handle_image(self.request, File(image_file, name='image'), filetype=filetype)[0], name=f'{uuid.uuid4()}_{recipe.pk}{filetype}')
+ recipe.image = File(handle_image(self.request, File(image_file, name='image'), filetype=filetype), name=f'{uuid.uuid4()}_{recipe.pk}{filetype}')
recipe.save()
def get_recipe_from_file(self, file):
diff --git a/cookbook/locale/de/LC_MESSAGES/django.po b/cookbook/locale/de/LC_MESSAGES/django.po
index 0f9c05294..ad6f1e0ab 100644
--- a/cookbook/locale/de/LC_MESSAGES/django.po
+++ b/cookbook/locale/de/LC_MESSAGES/django.po
@@ -2467,7 +2467,7 @@ msgid ""
msgstr ""
"Das direkte ausliefern von Mediendateien mit gunicorn/python ist nicht "
"empfehlenswert! Bitte folge den beschriebenen Schritten hier, um Ihre "
+"://github.com/vabene1111/recipes/releases/tag/0.8.1\">hier, um Ihre "
"Installation zu aktualisieren.\n"
" "
diff --git a/cookbook/templates/base.html b/cookbook/templates/base.html
index 625a96fec..9ca099ba1 100644
--- a/cookbook/templates/base.html
+++ b/cookbook/templates/base.html
@@ -337,6 +337,12 @@
{% endif %}
+{% if HOSTED and request.space.max_recipes == 10 %}
+