From 0bcfbc941b832ab947e4f9c1b22e17aab7dc7e2a Mon Sep 17 00:00:00 2001 From: Justin Wong <46082645+uvjustin@users.noreply.github.com> Date: Fri, 19 Aug 2022 17:52:45 +0800 Subject: [PATCH] Unquote label in flask routes Encode label in Camera.jsx --- frigate/http.py | 47 ++++++++++++++++++++++----------------- web/src/routes/Camera.jsx | 4 ++-- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index b7ed51783..c5e5a1f9a 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -8,6 +8,7 @@ import subprocess as sp import time from functools import reduce from pathlib import Path +from urllib.parse import unquote import cv2 @@ -17,6 +18,7 @@ from flask import ( Flask, Response, current_app, + g, jsonify, make_response, request, @@ -35,6 +37,11 @@ logger = logging.getLogger(__name__) bp = Blueprint("frigate", __name__) +@bp.url_value_preprocessor +def unquote_label(endpoint, values): + g.label = unquote(values.pop("label", "")) + + def create_app( frigate_config, database: SqliteDatabase, @@ -340,8 +347,8 @@ def event_thumbnail(id, max_cache_age=2592000): @bp.route("//