From 8c45dab9b8ff89064971af274d1bc901197a27b5 Mon Sep 17 00:00:00 2001 From: uvjustin <46082645+uvjustin@users.noreply.github.com> Date: Thu, 25 Aug 2022 20:32:30 +0800 Subject: [PATCH] Handle spaces in labels (#3679) * Unquote label in flask routes Encode label in Camera.jsx * Don't use preprocessor * Update nginx location for cacheable images --- docker/rootfs/usr/local/nginx/conf/nginx.conf | 5 +-- frigate/http.py | 31 ++++++++++--------- web/src/routes/Camera.jsx | 4 +-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/docker/rootfs/usr/local/nginx/conf/nginx.conf b/docker/rootfs/usr/local/nginx/conf/nginx.conf index 7437f42fd..d1e13eb31 100644 --- a/docker/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/rootfs/usr/local/nginx/conf/nginx.conf @@ -172,10 +172,11 @@ http { proxy_set_header Host $host; } - location ~* /api/(.*\.(jpg|jpeg|png)$) { + location ~* /api/.*\.(jpg|jpeg|png)$ { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; - proxy_pass http://frigate_api/$1$is_args$args; + rewrite ^/api/(.*)$ $1 break; + proxy_pass http://frigate_api; proxy_pass_request_headers on; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/frigate/http.py b/frigate/http.py index b7ed51783..84a8c855e 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 @@ -341,6 +342,7 @@ def event_thumbnail(id, max_cache_age=2592000): @bp.route("//