From 5480f6d35b1c029f88746bee0f86fb5a78dd5cc6 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Mon, 14 Sep 2020 19:54:00 +0200 Subject: [PATCH] handle case highlight_id is not int --- app/dashboard/views/refused_email.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/dashboard/views/refused_email.py b/app/dashboard/views/refused_email.py index 6e947d3a..47a0ad6d 100644 --- a/app/dashboard/views/refused_email.py +++ b/app/dashboard/views/refused_email.py @@ -2,6 +2,7 @@ from flask import render_template, request from flask_login import login_required, current_user from app.dashboard.base import dashboard_bp +from app.log import LOG from app.models import EmailLog @@ -11,7 +12,11 @@ def refused_email_route(): # Highlight a refused email highlight_id = request.args.get("highlight_id") if highlight_id: - highlight_id = int(highlight_id) + try: + highlight_id = int(highlight_id) + except ValueError: + LOG.warning("Cannot parse highlight_id %s", highlight_id) + highlight_id = None email_logs: [EmailLog] = ( EmailLog.query.filter(