diff --git a/helper.py b/helper.py index 7c0cc7e..9a29051 100755 --- a/helper.py +++ b/helper.py @@ -48,7 +48,7 @@ wait_between_attempts = 0.1 picture_watcher.watch( - alias="image", path=img_input_file, flags=aionotify.Flags.MODIFY + alias="image", path=img_input_file, flags=aionotify.Flags.CLOSE_WRITE ) # sets up watcher diff --git a/shepherd/blueprints/upload/__init__.py b/shepherd/blueprints/upload/__init__.py index 952a181..145d0ea 100644 --- a/shepherd/blueprints/upload/__init__.py +++ b/shepherd/blueprints/upload/__init__.py @@ -25,15 +25,11 @@ def upload(): file = request.files["uploaded_file"] except KeyError: abort(400) - if file.filename == "": - flash("You didn't upload a file.", "error") - else: - flash("Got a file with filename {}".format(file.filename), "debug") + if file.filename != "": err = process_uploaded_file(file) if err: - flash(err, "error") + return f"{err}", 400 else: - flash("Your file looks good!", "success") # TODO: run a linter on the code? run.send("upload") return "", 204