Commit 59d1084e authored by Anthony Jacob's avatar Anthony Jacob
Browse files

check if uploaded file is an image

parent ac0fc1af
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -232,6 +232,11 @@ def upload_about_picture(id):
                    return jsonify({"error": "you have to provide a picture"}), 400

                file = request.files["file"]

                # Check if the file is an image
                if not file.mimetype.startswith("image/"):
                    return jsonify({"error": "The uploaded file must be an image"}), 400

                unique_filename = get_unique_filename(
                    current_app.config["LOGO_DIR"], file.filename
                )
+5 −0
Original line number Diff line number Diff line
@@ -393,6 +393,11 @@ def upload_experience_logo(id):
                    return jsonify({"error": "you have to provide a logo"}), 400

                file = request.files["file"]

                # Check if the file is an image
                if not file.mimetype.startswith("image/"):
                    return jsonify({"error": "The uploaded file must be an image"}), 400

                unique_filename = get_unique_filename(
                    current_app.config["LOGO_DIR"], file.filename
                )
+5 −0
Original line number Diff line number Diff line
@@ -345,6 +345,11 @@ def upload_service_logo(id):
                    return jsonify({"error": "you have to provide a logo"}), 400

                file = request.files["file"]

                # Check if the file is an image
                if not file.mimetype.startswith("image/"):
                    return jsonify({"error": "The uploaded file must be an image"}), 400

                unique_filename = get_unique_filename(
                    current_app.config["LOGO_DIR"], file.filename
                )