-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle spaces in labels #3679
Handle spaces in labels #3679
Conversation
Encode label in Camera.jsx
9d79f6f
to
466f8b6
Compare
Thanks for this! I was going to create a PR next week when my schedule freed up a bit, but I'm glad you beat me to it. I love the open source community! |
@hawkeye217 Can you test it on your end? I don't have any events with those labels, and more importantly I have a hard time building the frontend as my 7 year old laptop doesn't seem to be able to run the dev container. |
@uvjustin I don't have a full dev environment set up either, but you can actually just build the frontend and connect it to an existing Frigate instance. I did that and copied in your modified http.py to my existing Frigate instance (I know, quite a hack, but it was faster than building everything just to test the change). And I got the same 400 error. I think the issue is with the nginx configuration inside the container. Looking at the nginx docs and this issue, it appears that the @blakeblackshear made this commit to nginx.conf, and I'm guessing it was probably to cache images. I removed the entire section, lines 175-183 from nginx.conf and image urls with parameters are still working, likely because the section below it (lines 185-196) is correctly proxying the I'm no nginx expert, so maybe there's a better solution. I think there's caching with images to consider as well. Hope this helps! |
I also realized the frontend isn't required to reproduce the bug - just making a request to the frigate http api endpoint for an object type that has a space in the label will cause the nginx error. For example:
will return 400 from nginx. |
for now you could rename objects in the labelmap to have the |
For sure. That would work for objects moving forward. But anything already in the database for the old label wouldn't show up in the event list. Not a big deal for me, but I'm thinking ahead to Frigate+ and any labels that have spaces. |
They show up, the db doesn't clear out old events like that, same thing as to why #3184 can create custom labels without worrying about that. And Frigate+ could similarly not use spaces and use _ instead In any case, it should be fixed in the longer term for sure. |
Maybe I was misunderstanding. I updated my labelmap and my config to change "sports ball" to "ball", and the events that were categorized under "sports ball" no longer show up in my UI after restart. Of course they're still in the database, because I can switch everything back in the config, restart, and they all show up in the UI again. Not a common use case, though. And I didn't have the issue on 0.10.1. I only noticed it when upgrading to 0.11 pre. Other than this and the jellyfin issue, 0.11 has been great for me! |
Frigate+ actually already does use _ for example in the label
Interesting, the UI should be a direct reflection of the db so that doesn't seem to make sense 🤔 Seems like Nginx doesn't make this particular case easy assuming that the variables are needed. |
I could build the frontend outside the container, but given that I don't even have events with the offending labels to easily test on, I'd rather not clutter up this old computer (I don't use JS much and don't even have npm on the computer). Anyway, thanks for taking the time to try it out. |
I noticed @NickM-27 opened up #3708 which renders _ as spaces in the frontend. In that case, rending a label with _ and a label with space will look just as pretty, and perhaps just converting spaces to _ when importing the coco labels is the easier solution. But since the old stored events will still have the old label name (with spaces), these names would have to be updated in migrations. |
To be clear, my change was just for the frontend readability and wasn't to address this. I don't know enough about nginx to say what the preferred approach is 👍 Either solution seems viable to me |
Tested this by changing "person" to "per son" and everything appears to be working correctly. |
I can also confirm the updated nginx.conf is working as expected. Thanks @uvjustin! |
Also use
camera_name
instead ofcamera
in all routes for consistency.Something like this should work for #3678, but I haven't tested this yet.