NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
fix renaming exports with a slash (#16588)
Josh Hawkins6bb1a5dfd2dd
diff --git a/frigate/api/defs/request/export_rename_body.py b/frigate/api/defs/request/export_rename_body.pynew file mode 100644index 0000000000..dc5bc32f9b--- /dev/null+++ b/frigate/api/defs/request/export_rename_body.py@@ -0,0 +1,5 @@+from pydantic import BaseModel, Field+++class ExportRenameBody(BaseModel):+ name: str = Field(title="Friendly name", max_length=256)diff --git a/frigate/api/export.py b/frigate/api/export.pyindex ba0f8be28c..2ccbc4beb4 100644--- a/frigate/api/export.py+++ b/frigate/api/export.py@@ -12,6 +12,7 @@ from peewee import DoesNotExistfrom playhouse.shortcuts import model_to_dictfrom frigate.api.defs.request.export_recordings_body import ExportRecordingsBody+from frigate.api.defs.request.export_rename_body import ExportRenameBodyfrom frigate.api.defs.tags import Tagsfrom frigate.const import EXPORT_DIRfrom frigate.models import Export, Previews, Recordings@@ -129,8 +130,8 @@ def export_recording()[email protected]("/export/{event_id}/{new_name}")-def export_rename(event_id: str, new_name: str):[email protected]("/export/{event_id}/rename")+def export_rename(event_id: str, body: ExportRenameBody):try:export: Export = Export.get(Export.id == event_id)except DoesNotExist:@@ -144,7 +145,7 @@ def export_rename(event_id: str, new_name: str):status_code=404,)- export.name = new_name+ export.name = body.nameexport.save()return JSONResponse(content=(diff --git a/web/src/pages/Exports.tsx b/web/src/pages/Exports.tsxindex 212b001f0d..529bb2e266 100644--- a/web/src/pages/Exports.tsx+++ b/web/src/pages/Exports.tsx@@ -83,9 +83,11 @@ function Exports() {const onHandleRename = useCallback((id: string, update: string) => {axios- .patch(`export/${id}/${encodeURIComponent(update)}`)+ .patch(`export/${id}/rename`, {+ name: update,+ }).then((response) => {- if (response.status == 200) {+ if (response.status === 200) {setDeleteClip(undefined);mutate();}