fix: strip null synth_engine from project JSON

- Frontend serialize: use undefined instead of null for synth_engine
- Backend validate: strip None synth_engine from tracks before schema validation
- Prevents 'None is not of type object' schema error
This commit is contained in:
2026-07-26 18:22:35 +07:00
parent 7af0e61fb0
commit e843f55483
3 changed files with 11 additions and 3 deletions
+8
View File
@@ -99,6 +99,14 @@ def validate_project_data(data_json: str) -> str:
data = json.loads(data_json)
if "project_id" not in data:
data["project_id"] = "temp_legacy_" + str(int(time.time()))
# Strip null synth_engine from tracks (breaks schema validation)
for session_key in ["main_session"] + [k for k in data.get("section_store", {})]:
session = data.get(session_key)
if not session:
continue
for track in session.get("tracks", []):
if "synth_engine" in track and track["synth_engine"] is None:
del track["synth_engine"]
if "main_session" not in data:
data = upgrade_project_json_if_needed(data)
data_json = json.dumps(data)