diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 3f59d96..cc45160 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.0.40" +__version__ = "4.0.0.41" diff --git a/cbpi/controller/upload_controller.py b/cbpi/controller/upload_controller.py index 6672865..19d911e 100644 --- a/cbpi/controller/upload_controller.py +++ b/cbpi/controller/upload_controller.py @@ -23,6 +23,7 @@ from ..api.step import StepMove, StepResult, StepState import re import base64 + class UploadController: def __init__(self, cbpi): @@ -110,7 +111,7 @@ class UploadController: if content_type == 'text/xml': try: - beer_xml = recipe_file.read().decode() + beer_xml = recipe_file.read().decode('utf-8','replace') if recipe_file and self.allowed_file(filename, 'xml'): self.path = os.path.join(".", 'config', "upload", "beer.xml") @@ -118,8 +119,8 @@ class UploadController: f.write(beer_xml) f.close() self.cbpi.notify("Success", "XML Recipe {} has been uploaded".format(filename), NotificationType.SUCCESS) - except: - self.cbpi.notify("Error" "XML Recipe upload failed", NotificationType.ERROR) + except Exception as e: + self.cbpi.notify("Error" "XML Recipe upload failed: {}".format(e), NotificationType.ERROR) pass elif content_type == 'application/octet-stream':